ip_input.c (780b2f698ccad0ba49e4837bf4b30e5af19b3926) | ip_input.c (ef39adf007d3a9125dc4a03ece5a586c1519e8b8) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 52 unchanged lines hidden (view full) --- 61 62#include <netinet/in.h> 63#include <netinet/in_systm.h> 64#include <netinet/in_var.h> 65#include <netinet/ip.h> 66#include <netinet/in_pcb.h> 67#include <netinet/ip_var.h> 68#include <netinet/ip_icmp.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 52 unchanged lines hidden (view full) --- 61 62#include <netinet/in.h> 63#include <netinet/in_systm.h> 64#include <netinet/in_var.h> 65#include <netinet/ip.h> 66#include <netinet/in_pcb.h> 67#include <netinet/ip_var.h> 68#include <netinet/ip_icmp.h> |
69#include <netinet/ip_options.h> |
|
69#include <machine/in_cksum.h> 70#ifdef DEV_CARP 71#include <netinet/ip_carp.h> 72#endif 73 74#include <sys/socketvar.h> 75 76/* XXX: Temporary until ipfw_ether and ipfw_bridge are converted. */ --- 19 unchanged lines hidden (view full) --- 96static int ipsendredirects = 1; /* XXX */ 97SYSCTL_INT(_net_inet_ip, IPCTL_SENDREDIRECTS, redirect, CTLFLAG_RW, 98 &ipsendredirects, 0, "Enable sending IP redirects"); 99 100int ip_defttl = IPDEFTTL; 101SYSCTL_INT(_net_inet_ip, IPCTL_DEFTTL, ttl, CTLFLAG_RW, 102 &ip_defttl, 0, "Maximum TTL on IP packets"); 103 | 70#include <machine/in_cksum.h> 71#ifdef DEV_CARP 72#include <netinet/ip_carp.h> 73#endif 74 75#include <sys/socketvar.h> 76 77/* XXX: Temporary until ipfw_ether and ipfw_bridge are converted. */ --- 19 unchanged lines hidden (view full) --- 97static int ipsendredirects = 1; /* XXX */ 98SYSCTL_INT(_net_inet_ip, IPCTL_SENDREDIRECTS, redirect, CTLFLAG_RW, 99 &ipsendredirects, 0, "Enable sending IP redirects"); 100 101int ip_defttl = IPDEFTTL; 102SYSCTL_INT(_net_inet_ip, IPCTL_DEFTTL, ttl, CTLFLAG_RW, 103 &ip_defttl, 0, "Maximum TTL on IP packets"); 104 |
104static int ip_dosourceroute = 0; 105SYSCTL_INT(_net_inet_ip, IPCTL_SOURCEROUTE, sourceroute, CTLFLAG_RW, 106 &ip_dosourceroute, 0, "Enable forwarding source routed IP packets"); 107 108static int ip_acceptsourceroute = 0; 109SYSCTL_INT(_net_inet_ip, IPCTL_ACCEPTSOURCEROUTE, accept_sourceroute, 110 CTLFLAG_RW, &ip_acceptsourceroute, 0, 111 "Enable accepting source routed IP packets"); 112 113int ip_doopts = 1; /* 0 = ignore, 1 = process, 2 = reject */ 114SYSCTL_INT(_net_inet_ip, OID_AUTO, process_options, CTLFLAG_RW, 115 &ip_doopts, 0, "Enable IP options processing ([LS]SRR, RR, TS)"); 116 | |
117static int ip_keepfaith = 0; 118SYSCTL_INT(_net_inet_ip, IPCTL_KEEPFAITH, keepfaith, CTLFLAG_RW, 119 &ip_keepfaith, 0, 120 "Enable packet capture for FAITH IPv4->IPv6 translater daemon"); 121 122static int nipq = 0; /* total # of reass queues */ 123static int maxnipq; 124SYSCTL_INT(_net_inet_ip, OID_AUTO, maxfragpackets, CTLFLAG_RW, --- 88 unchanged lines hidden (view full) --- 213 * ipfw_ether and ipfw_bridge hooks. 214 * XXX: Temporary until those are converted to pfil_hooks as well. 215 */ 216ip_fw_chk_t *ip_fw_chk_ptr = NULL; 217ip_dn_io_t *ip_dn_io_ptr = NULL; 218int fw_enable = 1; 219int fw_one_pass = 1; 220 | 105static int ip_keepfaith = 0; 106SYSCTL_INT(_net_inet_ip, IPCTL_KEEPFAITH, keepfaith, CTLFLAG_RW, 107 &ip_keepfaith, 0, 108 "Enable packet capture for FAITH IPv4->IPv6 translater daemon"); 109 110static int nipq = 0; /* total # of reass queues */ 111static int maxnipq; 112SYSCTL_INT(_net_inet_ip, OID_AUTO, maxfragpackets, CTLFLAG_RW, --- 88 unchanged lines hidden (view full) --- 201 * ipfw_ether and ipfw_bridge hooks. 202 * XXX: Temporary until those are converted to pfil_hooks as well. 203 */ 204ip_fw_chk_t *ip_fw_chk_ptr = NULL; 205ip_dn_io_t *ip_dn_io_ptr = NULL; 206int fw_enable = 1; 207int fw_one_pass = 1; 208 |
221/* 222 * XXX this is ugly. IP options source routing magic. 223 */ 224struct ipoptrt { 225 struct in_addr dst; /* final destination */ 226 char nop; /* one NOP to align */ 227 char srcopt[IPOPT_OFFSET + 1]; /* OPTVAL, OLEN and OFFSET */ 228 struct in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)]; 229}; 230 231struct ipopt_tag { 232 struct m_tag tag; 233 int ip_nhops; 234 struct ipoptrt ip_srcrt; 235}; 236 237static void save_rte(struct mbuf *, u_char *, struct in_addr); 238static int ip_dooptions(struct mbuf *m, int); 239static void ip_forward(struct mbuf *m, int srcrt); | |
240static void ip_freef(struct ipqhead *, struct ipq *); 241 242/* 243 * IP initialization: fill in IP protocol switch table. 244 * All protocols not implemented in kernel go to raw IP protocol handler. 245 */ 246void 247ip_init() --- 986 unchanged lines hidden (view full) --- 1234 if (ip_protox[ipproto] == pr - inetsw) /* IPPROTO_RAW */ 1235 return (ENOENT); 1236 1237 /* Reset the protocol slot to IPPROTO_RAW. */ 1238 ip_protox[ipproto] = pr - inetsw; 1239 return (0); 1240} 1241 | 209static void ip_freef(struct ipqhead *, struct ipq *); 210 211/* 212 * IP initialization: fill in IP protocol switch table. 213 * All protocols not implemented in kernel go to raw IP protocol handler. 214 */ 215void 216ip_init() --- 986 unchanged lines hidden (view full) --- 1203 if (ip_protox[ipproto] == pr - inetsw) /* IPPROTO_RAW */ 1204 return (ENOENT); 1205 1206 /* Reset the protocol slot to IPPROTO_RAW. */ 1207 ip_protox[ipproto] = pr - inetsw; 1208 return (0); 1209} 1210 |
1242 | |
1243/* | 1211/* |
1244 * Do option processing on a datagram, 1245 * possibly discarding it if bad options are encountered, 1246 * or forwarding it if source-routed. 1247 * The pass argument is used when operating in the IPSTEALTH 1248 * mode to tell what options to process: 1249 * [LS]SRR (pass 0) or the others (pass 1). 1250 * The reason for as many as two passes is that when doing IPSTEALTH, 1251 * non-routing options should be processed only if the packet is for us. 1252 * Returns 1 if packet has been forwarded/freed, 1253 * 0 if the packet should be processed further. 1254 */ 1255static int 1256ip_dooptions(struct mbuf *m, int pass) 1257{ 1258 struct ip *ip = mtod(m, struct ip *); 1259 u_char *cp; 1260 struct in_ifaddr *ia; 1261 int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0; 1262 struct in_addr *sin, dst; 1263 n_time ntime; 1264 struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; 1265 1266 /* ignore or reject packets with IP options */ 1267 if (ip_doopts == 0) 1268 return 0; 1269 else if (ip_doopts == 2) { 1270 type = ICMP_UNREACH; 1271 code = ICMP_UNREACH_FILTER_PROHIB; 1272 goto bad; 1273 } 1274 1275 dst = ip->ip_dst; 1276 cp = (u_char *)(ip + 1); 1277 cnt = (ip->ip_hl << 2) - sizeof (struct ip); 1278 for (; cnt > 0; cnt -= optlen, cp += optlen) { 1279 opt = cp[IPOPT_OPTVAL]; 1280 if (opt == IPOPT_EOL) 1281 break; 1282 if (opt == IPOPT_NOP) 1283 optlen = 1; 1284 else { 1285 if (cnt < IPOPT_OLEN + sizeof(*cp)) { 1286 code = &cp[IPOPT_OLEN] - (u_char *)ip; 1287 goto bad; 1288 } 1289 optlen = cp[IPOPT_OLEN]; 1290 if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) { 1291 code = &cp[IPOPT_OLEN] - (u_char *)ip; 1292 goto bad; 1293 } 1294 } 1295 switch (opt) { 1296 1297 default: 1298 break; 1299 1300 /* 1301 * Source routing with record. 1302 * Find interface with current destination address. 1303 * If none on this machine then drop if strictly routed, 1304 * or do nothing if loosely routed. 1305 * Record interface address and bring up next address 1306 * component. If strictly routed make sure next 1307 * address is on directly accessible net. 1308 */ 1309 case IPOPT_LSRR: 1310 case IPOPT_SSRR: 1311#ifdef IPSTEALTH 1312 if (ipstealth && pass > 0) 1313 break; 1314#endif 1315 if (optlen < IPOPT_OFFSET + sizeof(*cp)) { 1316 code = &cp[IPOPT_OLEN] - (u_char *)ip; 1317 goto bad; 1318 } 1319 if ((off = cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { 1320 code = &cp[IPOPT_OFFSET] - (u_char *)ip; 1321 goto bad; 1322 } 1323 ipaddr.sin_addr = ip->ip_dst; 1324 ia = (struct in_ifaddr *) 1325 ifa_ifwithaddr((struct sockaddr *)&ipaddr); 1326 if (ia == NULL) { 1327 if (opt == IPOPT_SSRR) { 1328 type = ICMP_UNREACH; 1329 code = ICMP_UNREACH_SRCFAIL; 1330 goto bad; 1331 } 1332 if (!ip_dosourceroute) 1333 goto nosourcerouting; 1334 /* 1335 * Loose routing, and not at next destination 1336 * yet; nothing to do except forward. 1337 */ 1338 break; 1339 } 1340 off--; /* 0 origin */ 1341 if (off > optlen - (int)sizeof(struct in_addr)) { 1342 /* 1343 * End of source route. Should be for us. 1344 */ 1345 if (!ip_acceptsourceroute) 1346 goto nosourcerouting; 1347 save_rte(m, cp, ip->ip_src); 1348 break; 1349 } 1350#ifdef IPSTEALTH 1351 if (ipstealth) 1352 goto dropit; 1353#endif 1354 if (!ip_dosourceroute) { 1355 if (ipforwarding) { 1356 char buf[16]; /* aaa.bbb.ccc.ddd\0 */ 1357 /* 1358 * Acting as a router, so generate ICMP 1359 */ 1360nosourcerouting: 1361 strcpy(buf, inet_ntoa(ip->ip_dst)); 1362 log(LOG_WARNING, 1363 "attempted source route from %s to %s\n", 1364 inet_ntoa(ip->ip_src), buf); 1365 type = ICMP_UNREACH; 1366 code = ICMP_UNREACH_SRCFAIL; 1367 goto bad; 1368 } else { 1369 /* 1370 * Not acting as a router, so silently drop. 1371 */ 1372#ifdef IPSTEALTH 1373dropit: 1374#endif 1375 ipstat.ips_cantforward++; 1376 m_freem(m); 1377 return (1); 1378 } 1379 } 1380 1381 /* 1382 * locate outgoing interface 1383 */ 1384 (void)memcpy(&ipaddr.sin_addr, cp + off, 1385 sizeof(ipaddr.sin_addr)); 1386 1387 if (opt == IPOPT_SSRR) { 1388#define INA struct in_ifaddr * 1389#define SA struct sockaddr * 1390 if ((ia = (INA)ifa_ifwithdstaddr((SA)&ipaddr)) == NULL) 1391 ia = (INA)ifa_ifwithnet((SA)&ipaddr); 1392 } else 1393 ia = ip_rtaddr(ipaddr.sin_addr); 1394 if (ia == NULL) { 1395 type = ICMP_UNREACH; 1396 code = ICMP_UNREACH_SRCFAIL; 1397 goto bad; 1398 } 1399 ip->ip_dst = ipaddr.sin_addr; 1400 (void)memcpy(cp + off, &(IA_SIN(ia)->sin_addr), 1401 sizeof(struct in_addr)); 1402 cp[IPOPT_OFFSET] += sizeof(struct in_addr); 1403 /* 1404 * Let ip_intr's mcast routing check handle mcast pkts 1405 */ 1406 forward = !IN_MULTICAST(ntohl(ip->ip_dst.s_addr)); 1407 break; 1408 1409 case IPOPT_RR: 1410#ifdef IPSTEALTH 1411 if (ipstealth && pass == 0) 1412 break; 1413#endif 1414 if (optlen < IPOPT_OFFSET + sizeof(*cp)) { 1415 code = &cp[IPOPT_OFFSET] - (u_char *)ip; 1416 goto bad; 1417 } 1418 if ((off = cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { 1419 code = &cp[IPOPT_OFFSET] - (u_char *)ip; 1420 goto bad; 1421 } 1422 /* 1423 * If no space remains, ignore. 1424 */ 1425 off--; /* 0 origin */ 1426 if (off > optlen - (int)sizeof(struct in_addr)) 1427 break; 1428 (void)memcpy(&ipaddr.sin_addr, &ip->ip_dst, 1429 sizeof(ipaddr.sin_addr)); 1430 /* 1431 * locate outgoing interface; if we're the destination, 1432 * use the incoming interface (should be same). 1433 */ 1434 if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) == NULL && 1435 (ia = ip_rtaddr(ipaddr.sin_addr)) == NULL) { 1436 type = ICMP_UNREACH; 1437 code = ICMP_UNREACH_HOST; 1438 goto bad; 1439 } 1440 (void)memcpy(cp + off, &(IA_SIN(ia)->sin_addr), 1441 sizeof(struct in_addr)); 1442 cp[IPOPT_OFFSET] += sizeof(struct in_addr); 1443 break; 1444 1445 case IPOPT_TS: 1446#ifdef IPSTEALTH 1447 if (ipstealth && pass == 0) 1448 break; 1449#endif 1450 code = cp - (u_char *)ip; 1451 if (optlen < 4 || optlen > 40) { 1452 code = &cp[IPOPT_OLEN] - (u_char *)ip; 1453 goto bad; 1454 } 1455 if ((off = cp[IPOPT_OFFSET]) < 5) { 1456 code = &cp[IPOPT_OLEN] - (u_char *)ip; 1457 goto bad; 1458 } 1459 if (off > optlen - (int)sizeof(int32_t)) { 1460 cp[IPOPT_OFFSET + 1] += (1 << 4); 1461 if ((cp[IPOPT_OFFSET + 1] & 0xf0) == 0) { 1462 code = &cp[IPOPT_OFFSET] - (u_char *)ip; 1463 goto bad; 1464 } 1465 break; 1466 } 1467 off--; /* 0 origin */ 1468 sin = (struct in_addr *)(cp + off); 1469 switch (cp[IPOPT_OFFSET + 1] & 0x0f) { 1470 1471 case IPOPT_TS_TSONLY: 1472 break; 1473 1474 case IPOPT_TS_TSANDADDR: 1475 if (off + sizeof(n_time) + 1476 sizeof(struct in_addr) > optlen) { 1477 code = &cp[IPOPT_OFFSET] - (u_char *)ip; 1478 goto bad; 1479 } 1480 ipaddr.sin_addr = dst; 1481 ia = (INA)ifaof_ifpforaddr((SA)&ipaddr, 1482 m->m_pkthdr.rcvif); 1483 if (ia == NULL) 1484 continue; 1485 (void)memcpy(sin, &IA_SIN(ia)->sin_addr, 1486 sizeof(struct in_addr)); 1487 cp[IPOPT_OFFSET] += sizeof(struct in_addr); 1488 off += sizeof(struct in_addr); 1489 break; 1490 1491 case IPOPT_TS_PRESPEC: 1492 if (off + sizeof(n_time) + 1493 sizeof(struct in_addr) > optlen) { 1494 code = &cp[IPOPT_OFFSET] - (u_char *)ip; 1495 goto bad; 1496 } 1497 (void)memcpy(&ipaddr.sin_addr, sin, 1498 sizeof(struct in_addr)); 1499 if (ifa_ifwithaddr((SA)&ipaddr) == NULL) 1500 continue; 1501 cp[IPOPT_OFFSET] += sizeof(struct in_addr); 1502 off += sizeof(struct in_addr); 1503 break; 1504 1505 default: 1506 code = &cp[IPOPT_OFFSET + 1] - (u_char *)ip; 1507 goto bad; 1508 } 1509 ntime = iptime(); 1510 (void)memcpy(cp + off, &ntime, sizeof(n_time)); 1511 cp[IPOPT_OFFSET] += sizeof(n_time); 1512 } 1513 } 1514 if (forward && ipforwarding) { 1515 ip_forward(m, 1); 1516 return (1); 1517 } 1518 return (0); 1519bad: 1520 icmp_error(m, type, code, 0, 0); 1521 ipstat.ips_badoptions++; 1522 return (1); 1523} 1524 1525/* | |
1526 * Given address of next destination (final or next hop), 1527 * return internet address info of interface to be used to get there. 1528 */ 1529struct in_ifaddr * 1530ip_rtaddr(dst) 1531 struct in_addr dst; 1532{ 1533 struct route sro; --- 10 unchanged lines hidden (view full) --- 1544 if (sro.ro_rt == NULL) 1545 return (NULL); 1546 1547 ifa = ifatoia(sro.ro_rt->rt_ifa); 1548 RTFREE(sro.ro_rt); 1549 return (ifa); 1550} 1551 | 1212 * Given address of next destination (final or next hop), 1213 * return internet address info of interface to be used to get there. 1214 */ 1215struct in_ifaddr * 1216ip_rtaddr(dst) 1217 struct in_addr dst; 1218{ 1219 struct route sro; --- 10 unchanged lines hidden (view full) --- 1230 if (sro.ro_rt == NULL) 1231 return (NULL); 1232 1233 ifa = ifatoia(sro.ro_rt->rt_ifa); 1234 RTFREE(sro.ro_rt); 1235 return (ifa); 1236} 1237 |
1552/* 1553 * Save incoming source route for use in replies, 1554 * to be picked up later by ip_srcroute if the receiver is interested. 1555 */ 1556static void 1557save_rte(m, option, dst) 1558 struct mbuf *m; 1559 u_char *option; 1560 struct in_addr dst; 1561{ 1562 unsigned olen; 1563 struct ipopt_tag *opts; 1564 1565 opts = (struct ipopt_tag *)m_tag_get(PACKET_TAG_IPOPTIONS, 1566 sizeof(struct ipopt_tag), M_NOWAIT); 1567 if (opts == NULL) 1568 return; 1569 1570 olen = option[IPOPT_OLEN]; 1571#ifdef DIAGNOSTIC 1572 if (ipprintfs) 1573 printf("save_rte: olen %d\n", olen); 1574#endif 1575 if (olen > sizeof(opts->ip_srcrt) - (1 + sizeof(dst))) { 1576 m_tag_free((struct m_tag *)opts); 1577 return; 1578 } 1579 bcopy(option, opts->ip_srcrt.srcopt, olen); 1580 opts->ip_nhops = (olen - IPOPT_OFFSET - 1) / sizeof(struct in_addr); 1581 opts->ip_srcrt.dst = dst; 1582 m_tag_prepend(m, (struct m_tag *)opts); 1583} 1584 1585/* 1586 * Retrieve incoming source route for use in replies, 1587 * in the same form used by setsockopt. 1588 * The first hop is placed before the options, will be removed later. 1589 */ 1590struct mbuf * 1591ip_srcroute(m0) 1592 struct mbuf *m0; 1593{ 1594 register struct in_addr *p, *q; 1595 register struct mbuf *m; 1596 struct ipopt_tag *opts; 1597 1598 opts = (struct ipopt_tag *)m_tag_find(m0, PACKET_TAG_IPOPTIONS, NULL); 1599 if (opts == NULL) 1600 return (NULL); 1601 1602 if (opts->ip_nhops == 0) 1603 return (NULL); 1604 m = m_get(M_DONTWAIT, MT_DATA); 1605 if (m == NULL) 1606 return (NULL); 1607 1608#define OPTSIZ (sizeof(opts->ip_srcrt.nop) + sizeof(opts->ip_srcrt.srcopt)) 1609 1610 /* length is (nhops+1)*sizeof(addr) + sizeof(nop + srcrt header) */ 1611 m->m_len = opts->ip_nhops * sizeof(struct in_addr) + 1612 sizeof(struct in_addr) + OPTSIZ; 1613#ifdef DIAGNOSTIC 1614 if (ipprintfs) 1615 printf("ip_srcroute: nhops %d mlen %d", opts->ip_nhops, m->m_len); 1616#endif 1617 1618 /* 1619 * First save first hop for return route 1620 */ 1621 p = &(opts->ip_srcrt.route[opts->ip_nhops - 1]); 1622 *(mtod(m, struct in_addr *)) = *p--; 1623#ifdef DIAGNOSTIC 1624 if (ipprintfs) 1625 printf(" hops %lx", (u_long)ntohl(mtod(m, struct in_addr *)->s_addr)); 1626#endif 1627 1628 /* 1629 * Copy option fields and padding (nop) to mbuf. 1630 */ 1631 opts->ip_srcrt.nop = IPOPT_NOP; 1632 opts->ip_srcrt.srcopt[IPOPT_OFFSET] = IPOPT_MINOFF; 1633 (void)memcpy(mtod(m, caddr_t) + sizeof(struct in_addr), 1634 &(opts->ip_srcrt.nop), OPTSIZ); 1635 q = (struct in_addr *)(mtod(m, caddr_t) + 1636 sizeof(struct in_addr) + OPTSIZ); 1637#undef OPTSIZ 1638 /* 1639 * Record return path as an IP source route, 1640 * reversing the path (pointers are now aligned). 1641 */ 1642 while (p >= opts->ip_srcrt.route) { 1643#ifdef DIAGNOSTIC 1644 if (ipprintfs) 1645 printf(" %lx", (u_long)ntohl(q->s_addr)); 1646#endif 1647 *q++ = *p--; 1648 } 1649 /* 1650 * Last hop goes to final destination. 1651 */ 1652 *q = opts->ip_srcrt.dst; 1653#ifdef DIAGNOSTIC 1654 if (ipprintfs) 1655 printf(" %lx\n", (u_long)ntohl(q->s_addr)); 1656#endif 1657 m_tag_delete(m0, (struct m_tag *)opts); 1658 return (m); 1659} 1660 1661/* 1662 * Strip out IP options, at higher 1663 * level protocol in the kernel. 1664 * Second argument is buffer to which options 1665 * will be moved, and return value is their length. 1666 * XXX should be deleted; last arg currently ignored. 1667 */ 1668void 1669ip_stripoptions(m, mopt) 1670 register struct mbuf *m; 1671 struct mbuf *mopt; 1672{ 1673 register int i; 1674 struct ip *ip = mtod(m, struct ip *); 1675 register caddr_t opts; 1676 int olen; 1677 1678 olen = (ip->ip_hl << 2) - sizeof (struct ip); 1679 opts = (caddr_t)(ip + 1); 1680 i = m->m_len - (sizeof (struct ip) + olen); 1681 bcopy(opts + olen, opts, (unsigned)i); 1682 m->m_len -= olen; 1683 if (m->m_flags & M_PKTHDR) 1684 m->m_pkthdr.len -= olen; 1685 ip->ip_v = IPVERSION; 1686 ip->ip_hl = sizeof(struct ip) >> 2; 1687} 1688 | |
1689u_char inetctlerrmap[PRC_NCMDS] = { 1690 0, 0, 0, 0, 1691 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, 1692 EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, 1693 EMSGSIZE, EHOSTUNREACH, 0, 0, 1694 0, 0, EHOSTUNREACH, 0, 1695 ENOPROTOOPT, ECONNREFUSED 1696}; --- 438 unchanged lines hidden --- | 1238u_char inetctlerrmap[PRC_NCMDS] = { 1239 0, 0, 0, 0, 1240 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, 1241 EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, 1242 EMSGSIZE, EHOSTUNREACH, 0, 0, 1243 0, 0, EHOSTUNREACH, 0, 1244 ENOPROTOOPT, ECONNREFUSED 1245}; --- 438 unchanged lines hidden --- |