1*6350Ssam /* ip_input.c 1.36 82/03/29 */ 24571Swnj 34495Swnj #include "../h/param.h" 44543Swnj #include "../h/systm.h" 54640Swnj #include "../h/clock.h" 64640Swnj #include "../h/mbuf.h" 74898Swnj #include "../h/protosw.h" 84923Swnj #include "../h/socket.h" 95084Swnj #include "../net/in.h" 105084Swnj #include "../net/in_systm.h" 114951Swnj #include "../net/if.h" 125084Swnj #include "../net/ip.h" /* belongs before in.h */ 134898Swnj #include "../net/ip_var.h" 144801Swnj #include "../net/ip_icmp.h" 154801Swnj #include "../net/tcp.h" 166338Ssam #include "../net/route.h" 174495Swnj 186338Ssam #define IPTTLDEC 5 /* doesn't belong here */ 196338Ssam 204898Swnj u_char ip_protox[IPPROTO_MAX]; 216210Swnj int ipqmaxlen = IFQ_MAXLEN; 226338Ssam struct ifnet *ifinet; /* first inet interface */ 234898Swnj 244801Swnj /* 255172Swnj * IP initialization: fill in IP protocol switch table. 265161Swnj * All protocols not implemented in kernel go to raw IP protocol handler. 274801Swnj */ 284801Swnj ip_init() 294801Swnj { 304898Swnj register struct protosw *pr; 314898Swnj register int i; 324495Swnj 334951Swnj COUNT(IP_INIT); 344898Swnj pr = pffindproto(PF_INET, IPPROTO_RAW); 354898Swnj if (pr == 0) 364898Swnj panic("ip_init"); 374898Swnj for (i = 0; i < IPPROTO_MAX; i++) 384898Swnj ip_protox[i] = pr - protosw; 394898Swnj for (pr = protosw; pr <= protoswLAST; pr++) 404898Swnj if (pr->pr_family == PF_INET && 414898Swnj pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) 424898Swnj ip_protox[pr->pr_protocol] = pr - protosw; 434801Swnj ipq.next = ipq.prev = &ipq; 444801Swnj ip_id = time & 0xffff; 456210Swnj ipintrq.ifq_maxlen = ipqmaxlen; 466338Ssam ifinet = if_ifwithaf(AF_INET); 474801Swnj } 484801Swnj 494898Swnj u_char ipcksum = 1; 504640Swnj struct ip *ip_reass(); 516338Ssam int ipforwarding = 0; 526338Ssam struct sockaddr_in ipaddr = { AF_INET }; 534640Swnj 544640Swnj /* 554640Swnj * Ip input routine. Checksum and byte swap header. If fragmented 564640Swnj * try to reassamble. If complete and fragment queue exists, discard. 574640Swnj * Process options. Pass to next level. 584640Swnj */ 595084Swnj ipintr() 604495Swnj { 614923Swnj register struct ip *ip; 625084Swnj register struct mbuf *m; 635217Swnj struct mbuf *m0, *mopt; 644640Swnj register int i; 654495Swnj register struct ipq *fp; 665084Swnj int hlen, s; 674495Swnj 685084Swnj COUNT(IPINTR); 695084Swnj next: 704640Swnj /* 715084Swnj * Get next datagram off input queue and get IP header 725084Swnj * in first mbuf. 734640Swnj */ 745084Swnj s = splimp(); 755084Swnj IF_DEQUEUE(&ipintrq, m); 765084Swnj splx(s); 775218Swnj if (m == 0) 785084Swnj return; 795306Sroot if ((m->m_off > MMAXOFF || m->m_len < sizeof (struct ip)) && 805306Sroot (m = m_pullup(m, sizeof (struct ip))) == 0) 815306Sroot return; 824640Swnj ip = mtod(m, struct ip *); 835161Swnj if ((hlen = ip->ip_hl << 2) > m->m_len) { 845306Sroot if ((m = m_pullup(m, hlen)) == 0) 855306Sroot return; 865161Swnj ip = mtod(m, struct ip *); 875161Swnj } 884951Swnj if (ipcksum) 895217Swnj if (ip->ip_sum = in_cksum(m, hlen)) { 905161Swnj printf("ip_sum %x\n", ip->ip_sum); /* XXX */ 914951Swnj ipstat.ips_badsum++; 924951Swnj goto bad; 934495Swnj } 944951Swnj 955217Swnj #if vax 964951Swnj /* 974951Swnj * Convert fields to host representation. 984951Swnj */ 994907Swnj ip->ip_len = ntohs((u_short)ip->ip_len); 1004640Swnj ip->ip_id = ntohs(ip->ip_id); 1014951Swnj ip->ip_off = ntohs((u_short)ip->ip_off); 1025217Swnj #endif 1034495Swnj 1044543Swnj /* 1054640Swnj * Check that the amount of data in the buffers 1064640Swnj * is as at least much as the IP header would have us expect. 1074640Swnj * Trim mbufs if longer than we expect. 1084640Swnj * Drop packet if shorter than we expect. 1094543Swnj */ 1104640Swnj i = 0; 1115161Swnj m0 = m; 1126088Sroot for (; m != NULL; m = m->m_next) { 1136088Sroot if (m->m_free) panic("ipinput already free"); 1144495Swnj i += m->m_len; 1156088Sroot } 1164640Swnj m = m0; 1174640Swnj if (i != ip->ip_len) { 1185161Swnj if (i < ip->ip_len) { 1195161Swnj ipstat.ips_tooshort++; 1204951Swnj goto bad; 1215161Swnj } 1224640Swnj m_adj(m, ip->ip_len - i); 1234495Swnj } 1244495Swnj 1254640Swnj /* 1264640Swnj * Process options and, if not destined for us, 1274640Swnj * ship it on. 1284640Swnj */ 1294543Swnj if (hlen > sizeof (struct ip)) 1304907Swnj ip_dooptions(ip); 1316210Swnj 1326338Ssam /* 133*6350Ssam * Fast check on the first internet 134*6350Ssam * interface in the list. 1356338Ssam */ 1366338Ssam if (ifinet) { 1376338Ssam struct sockaddr_in *sin; 1386338Ssam 1396338Ssam sin = (struct sockaddr_in *)&ifinet->if_addr; 1406338Ssam if (sin->sin_addr.s_addr == ip->ip_dst.s_addr) 1416338Ssam goto ours; 142*6350Ssam if ((ifinet->if_flags & IFF_BROADCAST) && 143*6350Ssam sin->sin_addr.s_addr == ip->ip_dst.s_addr) 144*6350Ssam goto ours; 1456338Ssam } 1466338Ssam ipaddr.sin_addr = ip->ip_dst; 1476338Ssam if (if_ifwithaddr((struct sockaddr *)&ipaddr) == 0) { 1486338Ssam register struct rtentry *rt; 1496338Ssam 1506338Ssam printf("forward: dst %x ttl %x\n", ip->ip_dst, ip->ip_ttl); 1516338Ssam if (ipforwarding == 0) 1526338Ssam goto bad; 1536338Ssam if (ip->ip_ttl < IPTTLDEC) { 1544907Swnj icmp_error(ip, ICMP_TIMXCEED, 0); 1555084Swnj goto next; 1564495Swnj } 1576338Ssam ip->ip_ttl -= IPTTLDEC; 1585217Swnj mopt = m_get(M_DONTWAIT); 1595217Swnj if (mopt == 0) 1605217Swnj goto bad; 1615217Swnj ip_stripoptions(ip, mopt); 1626338Ssam 163*6350Ssam /* last 0 here means no directed broadcast */ 1646338Ssam (void) ip_output(m0, mopt, 0, 0); 1655084Swnj goto next; 1664543Swnj } 1674495Swnj 1686338Ssam ours: 1694640Swnj /* 1704640Swnj * Look for queue of fragments 1714640Swnj * of this datagram. 1724640Swnj */ 1734640Swnj for (fp = ipq.next; fp != &ipq; fp = fp->next) 1744640Swnj if (ip->ip_id == fp->ipq_id && 1754640Swnj ip->ip_src.s_addr == fp->ipq_src.s_addr && 1764640Swnj ip->ip_dst.s_addr == fp->ipq_dst.s_addr && 1774640Swnj ip->ip_p == fp->ipq_p) 1784640Swnj goto found; 1794640Swnj fp = 0; 1804640Swnj found: 1814495Swnj 1824640Swnj /* 1834640Swnj * Adjust ip_len to not reflect header, 1844640Swnj * set ip_mff if more fragments are expected, 1854640Swnj * convert offset of this to bytes. 1864640Swnj */ 1874640Swnj ip->ip_len -= hlen; 1884898Swnj ((struct ipasfrag *)ip)->ipf_mff = 0; 1894640Swnj if (ip->ip_off & IP_MF) 1904898Swnj ((struct ipasfrag *)ip)->ipf_mff = 1; 1914640Swnj ip->ip_off <<= 3; 1924495Swnj 1934640Swnj /* 1944640Swnj * If datagram marked as having more fragments 1954640Swnj * or if this is not the first fragment, 1964640Swnj * attempt reassembly; if it succeeds, proceed. 1974640Swnj */ 1984898Swnj if (((struct ipasfrag *)ip)->ipf_mff || ip->ip_off) { 1994898Swnj ip = ip_reass((struct ipasfrag *)ip, fp); 2004640Swnj if (ip == 0) 2015084Swnj goto next; 2024640Swnj hlen = ip->ip_hl << 2; 2034640Swnj m = dtom(ip); 2044640Swnj } else 2054640Swnj if (fp) 2064640Swnj (void) ip_freef(fp); 2074951Swnj 2084951Swnj /* 2094951Swnj * Switch out to protocol's input routine. 2104951Swnj */ 2114898Swnj (*protosw[ip_protox[ip->ip_p]].pr_input)(m); 2125084Swnj goto next; 2134951Swnj bad: 2144951Swnj m_freem(m); 2155084Swnj goto next; 2164640Swnj } 2174495Swnj 2184640Swnj /* 2194640Swnj * Take incoming datagram fragment and try to 2204951Swnj * reassemble it into whole datagram. If a chain for 2214640Swnj * reassembly of this datagram already exists, then it 2224640Swnj * is given as fp; otherwise have to make a chain. 2234640Swnj */ 2244640Swnj struct ip * 2254640Swnj ip_reass(ip, fp) 2264898Swnj register struct ipasfrag *ip; 2274640Swnj register struct ipq *fp; 2284640Swnj { 2294640Swnj register struct mbuf *m = dtom(ip); 2304898Swnj register struct ipasfrag *q; 2314640Swnj struct mbuf *t; 2324640Swnj int hlen = ip->ip_hl << 2; 2334640Swnj int i, next; 2344951Swnj COUNT(IP_REASS); 2354543Swnj 2364640Swnj /* 2374640Swnj * Presence of header sizes in mbufs 2384640Swnj * would confuse code below. 2394640Swnj */ 2404640Swnj m->m_off += hlen; 2414640Swnj m->m_len -= hlen; 2424495Swnj 2434640Swnj /* 2444640Swnj * If first fragment to arrive, create a reassembly queue. 2454640Swnj */ 2464640Swnj if (fp == 0) { 2475851Sroot if ((t = m_get(M_WAIT)) == NULL) 2484640Swnj goto dropfrag; 2494640Swnj t->m_off = MMINOFF; 2504640Swnj fp = mtod(t, struct ipq *); 2514640Swnj insque(fp, &ipq); 2524640Swnj fp->ipq_ttl = IPFRAGTTL; 2534640Swnj fp->ipq_p = ip->ip_p; 2544640Swnj fp->ipq_id = ip->ip_id; 2554898Swnj fp->ipq_next = fp->ipq_prev = (struct ipasfrag *)fp; 2564898Swnj fp->ipq_src = ((struct ip *)ip)->ip_src; 2574898Swnj fp->ipq_dst = ((struct ip *)ip)->ip_dst; 2585161Swnj q = (struct ipasfrag *)fp; 2595161Swnj goto insert; 2604640Swnj } 2614495Swnj 2624640Swnj /* 2634640Swnj * Find a segment which begins after this one does. 2644640Swnj */ 2654898Swnj for (q = fp->ipq_next; q != (struct ipasfrag *)fp; q = q->ipf_next) 2664640Swnj if (q->ip_off > ip->ip_off) 2674640Swnj break; 2684495Swnj 2694640Swnj /* 2704640Swnj * If there is a preceding segment, it may provide some of 2714640Swnj * our data already. If so, drop the data from the incoming 2724640Swnj * segment. If it provides all of our data, drop us. 2734640Swnj */ 2744898Swnj if (q->ipf_prev != (struct ipasfrag *)fp) { 2754898Swnj i = q->ipf_prev->ip_off + q->ipf_prev->ip_len - ip->ip_off; 2764640Swnj if (i > 0) { 2774640Swnj if (i >= ip->ip_len) 2784640Swnj goto dropfrag; 2794640Swnj m_adj(dtom(ip), i); 2804640Swnj ip->ip_off += i; 2814640Swnj ip->ip_len -= i; 2824640Swnj } 2834640Swnj } 2844543Swnj 2854640Swnj /* 2864640Swnj * While we overlap succeeding segments trim them or, 2874640Swnj * if they are completely covered, dequeue them. 2884640Swnj */ 2894898Swnj while (q != (struct ipasfrag *)fp && ip->ip_off + ip->ip_len > q->ip_off) { 2904640Swnj i = (ip->ip_off + ip->ip_len) - q->ip_off; 2914640Swnj if (i < q->ip_len) { 2924640Swnj q->ip_len -= i; 2936256Sroot q->ip_off += i; 2944640Swnj m_adj(dtom(q), i); 2954640Swnj break; 2964495Swnj } 2974898Swnj q = q->ipf_next; 2984898Swnj m_freem(dtom(q->ipf_prev)); 2994898Swnj ip_deq(q->ipf_prev); 3004543Swnj } 3014495Swnj 3025161Swnj insert: 3034640Swnj /* 3044640Swnj * Stick new segment in its place; 3054640Swnj * check for complete reassembly. 3064640Swnj */ 3074898Swnj ip_enq(ip, q->ipf_prev); 3084640Swnj next = 0; 3094898Swnj for (q = fp->ipq_next; q != (struct ipasfrag *)fp; q = q->ipf_next) { 3104640Swnj if (q->ip_off != next) 3114640Swnj return (0); 3124640Swnj next += q->ip_len; 3134640Swnj } 3144898Swnj if (q->ipf_prev->ipf_mff) 3154640Swnj return (0); 3164495Swnj 3174640Swnj /* 3184640Swnj * Reassembly is complete; concatenate fragments. 3194640Swnj */ 3204640Swnj q = fp->ipq_next; 3214640Swnj m = dtom(q); 3224640Swnj t = m->m_next; 3234640Swnj m->m_next = 0; 3244640Swnj m_cat(m, t); 3256298Swnj q = q->ipf_next; 3266298Swnj while (q != (struct ipasfrag *)fp) { 3276298Swnj t = dtom(q); 3286298Swnj q = q->ipf_next; 3296298Swnj m_cat(m, t); 3306298Swnj } 3314495Swnj 3324640Swnj /* 3334640Swnj * Create header for new ip packet by 3344640Swnj * modifying header of first packet; 3354640Swnj * dequeue and discard fragment reassembly header. 3364640Swnj * Make header visible. 3374640Swnj */ 3384640Swnj ip = fp->ipq_next; 3394640Swnj ip->ip_len = next; 3404898Swnj ((struct ip *)ip)->ip_src = fp->ipq_src; 3414898Swnj ((struct ip *)ip)->ip_dst = fp->ipq_dst; 3424640Swnj remque(fp); 3434907Swnj (void) m_free(dtom(fp)); 3444640Swnj m = dtom(ip); 3454898Swnj m->m_len += sizeof (struct ipasfrag); 3464898Swnj m->m_off -= sizeof (struct ipasfrag); 3474898Swnj return ((struct ip *)ip); 3484495Swnj 3494640Swnj dropfrag: 3504640Swnj m_freem(m); 3514640Swnj return (0); 3524495Swnj } 3534495Swnj 3544640Swnj /* 3554640Swnj * Free a fragment reassembly header and all 3564640Swnj * associated datagrams. 3574640Swnj */ 3584640Swnj struct ipq * 3594640Swnj ip_freef(fp) 3604640Swnj struct ipq *fp; 3614495Swnj { 3624898Swnj register struct ipasfrag *q; 3634640Swnj struct mbuf *m; 3644951Swnj COUNT(IP_FREEF); 3654495Swnj 3664898Swnj for (q = fp->ipq_next; q != (struct ipasfrag *)fp; q = q->ipf_next) 3674640Swnj m_freem(dtom(q)); 3684640Swnj m = dtom(fp); 3694640Swnj fp = fp->next; 3704640Swnj remque(fp->prev); 3714907Swnj (void) m_free(m); 3724640Swnj return (fp); 3734495Swnj } 3744495Swnj 3754640Swnj /* 3764640Swnj * Put an ip fragment on a reassembly chain. 3774640Swnj * Like insque, but pointers in middle of structure. 3784640Swnj */ 3794640Swnj ip_enq(p, prev) 3804898Swnj register struct ipasfrag *p, *prev; 3814495Swnj { 3824951Swnj 3834640Swnj COUNT(IP_ENQ); 3844898Swnj p->ipf_prev = prev; 3854898Swnj p->ipf_next = prev->ipf_next; 3864898Swnj prev->ipf_next->ipf_prev = p; 3874898Swnj prev->ipf_next = p; 3884495Swnj } 3894495Swnj 3904640Swnj /* 3914640Swnj * To ip_enq as remque is to insque. 3924640Swnj */ 3934640Swnj ip_deq(p) 3944898Swnj register struct ipasfrag *p; 3954640Swnj { 3964951Swnj 3974640Swnj COUNT(IP_DEQ); 3984898Swnj p->ipf_prev->ipf_next = p->ipf_next; 3994898Swnj p->ipf_next->ipf_prev = p->ipf_prev; 4004495Swnj } 4014495Swnj 4024640Swnj /* 4034640Swnj * IP timer processing; 4044640Swnj * if a timer expires on a reassembly 4054640Swnj * queue, discard it. 4064640Swnj */ 4074801Swnj ip_slowtimo() 4084495Swnj { 4094495Swnj register struct ipq *fp; 4104640Swnj int s = splnet(); 4114951Swnj 4124801Swnj COUNT(IP_SLOWTIMO); 4135243Sroot fp = ipq.next; 4145243Sroot if (fp == 0) { 4155243Sroot splx(s); 4165243Sroot return; 4175243Sroot } 4185243Sroot while (fp != &ipq) 4194640Swnj if (--fp->ipq_ttl == 0) 4204640Swnj fp = ip_freef(fp); 4214640Swnj else 4224640Swnj fp = fp->next; 4234640Swnj splx(s); 4244495Swnj } 4254495Swnj 4264951Swnj /* 4274951Swnj * Drain off all datagram fragments. 4284951Swnj */ 4294801Swnj ip_drain() 4304801Swnj { 4314801Swnj 4324951Swnj COUNT(IP_DRAIN); 4334951Swnj while (ipq.next != &ipq) 4344951Swnj (void) ip_freef(ipq.next); 4354801Swnj } 4364923Swnj 4374640Swnj /* 4384640Swnj * Do option processing on a datagram, 4394640Swnj * possibly discarding it if bad options 4404640Swnj * are encountered. 4414640Swnj */ 4424640Swnj ip_dooptions(ip) 4434640Swnj struct ip *ip; 4444495Swnj { 4454640Swnj register u_char *cp; 4464907Swnj int opt, optlen, cnt; 4474923Swnj struct in_addr *sin; 4484801Swnj register struct ip_timestamp *ipt; 4494951Swnj register struct ifnet *ifp; 4504951Swnj struct in_addr t; 4514495Swnj 4524951Swnj COUNT(IP_DOOPTIONS); 4534640Swnj cp = (u_char *)(ip + 1); 4544640Swnj cnt = (ip->ip_hl << 2) - sizeof (struct ip); 4554640Swnj for (; cnt > 0; cnt -= optlen, cp += optlen) { 4564640Swnj opt = cp[0]; 4574640Swnj if (opt == IPOPT_EOL) 4584640Swnj break; 4594640Swnj if (opt == IPOPT_NOP) 4604640Swnj optlen = 1; 4614640Swnj else 4624640Swnj optlen = cp[1]; 4634640Swnj switch (opt) { 4644495Swnj 4654640Swnj default: 4664640Swnj break; 4674495Swnj 4684951Swnj /* 4694951Swnj * Source routing with record. 4704951Swnj * Find interface with current destination address. 4714951Swnj * If none on this machine then drop if strictly routed, 4724951Swnj * or do nothing if loosely routed. 4734951Swnj * Record interface address and bring up next address 4744951Swnj * component. If strictly routed make sure next 4754951Swnj * address on directly accessible net. 4764951Swnj */ 4774640Swnj case IPOPT_LSRR: 4784801Swnj if (cp[2] < 4 || cp[2] > optlen - (sizeof (long) - 1)) 4794640Swnj break; 4804923Swnj sin = (struct in_addr *)(cp + cp[2]); 4816338Ssam ipaddr.sin_addr = *sin; 4826338Ssam ifp = if_ifwithaddr((struct sockaddr *)&ipaddr); 4834951Swnj if (ifp == 0) { 4844951Swnj if (opt == IPOPT_SSRR) 4854951Swnj goto bad; 4864951Swnj break; 4874640Swnj } 4884951Swnj t = ip->ip_dst; ip->ip_dst = *sin; *sin = t; 4894951Swnj cp[2] += 4; 4904951Swnj if (cp[2] > optlen - (sizeof (long) - 1)) 4914951Swnj break; 4924951Swnj ip->ip_dst = sin[1]; 4936338Ssam if (opt == IPOPT_SSRR && 4946338Ssam if_ifonnetof(ip->ip_dst.s_net) == 0) 4954951Swnj goto bad; 4964640Swnj break; 4974495Swnj 4984640Swnj case IPOPT_TS: 4994801Swnj ipt = (struct ip_timestamp *)cp; 5004801Swnj if (ipt->ipt_len < 5) 5014640Swnj goto bad; 5024801Swnj if (ipt->ipt_ptr > ipt->ipt_len - sizeof (long)) { 5034801Swnj if (++ipt->ipt_oflw == 0) 5044640Swnj goto bad; 5054495Swnj break; 5064640Swnj } 5074923Swnj sin = (struct in_addr *)(cp+cp[2]); 5084801Swnj switch (ipt->ipt_flg) { 5094495Swnj 5104640Swnj case IPOPT_TS_TSONLY: 5114640Swnj break; 5124640Swnj 5134640Swnj case IPOPT_TS_TSANDADDR: 5144801Swnj if (ipt->ipt_ptr + 8 > ipt->ipt_len) 5154640Swnj goto bad; 5166338Ssam if (ifinet == 0) 5176338Ssam goto bad; /* ??? */ 5186338Ssam *sin++ = ((struct sockaddr_in *)&ifinet->if_addr)->sin_addr; 5194640Swnj break; 5204640Swnj 5214640Swnj case IPOPT_TS_PRESPEC: 5226338Ssam ipaddr.sin_addr = *sin; 5236338Ssam if (if_ifwithaddr((struct sockaddr *)&ipaddr) == 0) 5244951Swnj continue; 5254801Swnj if (ipt->ipt_ptr + 8 > ipt->ipt_len) 5264640Swnj goto bad; 5274801Swnj ipt->ipt_ptr += 4; 5284640Swnj break; 5294640Swnj 5304495Swnj default: 5314640Swnj goto bad; 5324495Swnj } 5334923Swnj *(n_time *)sin = iptime(); 5344801Swnj ipt->ipt_ptr += 4; 5354640Swnj } 5364495Swnj } 5374907Swnj return; 5384640Swnj bad: 5394640Swnj /* SHOULD FORCE ICMP MESSAGE */ 5404907Swnj return; 5414495Swnj } 5424495Swnj 5434640Swnj /* 5444951Swnj * Strip out IP options, at higher 5454951Swnj * level protocol in the kernel. 5464951Swnj * Second argument is buffer to which options 5474951Swnj * will be moved, and return value is their length. 5484640Swnj */ 5495217Swnj ip_stripoptions(ip, mopt) 5504640Swnj struct ip *ip; 5515217Swnj struct mbuf *mopt; 5524495Swnj { 5534640Swnj register int i; 5544640Swnj register struct mbuf *m; 5554640Swnj int olen; 5564951Swnj COUNT(IP_STRIPOPTIONS); 5574640Swnj 5584640Swnj olen = (ip->ip_hl<<2) - sizeof (struct ip); 5594951Swnj m = dtom(ip); 5604951Swnj ip++; 5615217Swnj if (mopt) { 5625217Swnj mopt->m_len = olen; 5635217Swnj mopt->m_off = MMINOFF; 5645217Swnj bcopy((caddr_t)ip, mtod(m, caddr_t), (unsigned)olen); 5655217Swnj } 5664640Swnj i = m->m_len - (sizeof (struct ip) + olen); 5674907Swnj bcopy((caddr_t)ip+olen, (caddr_t)ip, (unsigned)i); 5685243Sroot m->m_len -= olen; 5694495Swnj } 570