From 346e0198f0078d8200ea1b38d5cd693b48ce6f62 Mon Sep 17 00:00:00 2001 From: itojun Date: Wed, 14 May 2003 06:47:33 +0000 Subject: [PATCH] always use PULLDOWN_TEST codepath. --- sys/net/if_loop.c | 56 +-------------------------- sys/netinet/ip6.h | 42 +------------------- sys/netinet/tcp_input.c | 68 +-------------------------------- sys/netinet/udp_usrreq.c | 42 +------------------- sys/netinet6/ah_input.c | 64 +------------------------------ sys/netinet6/dest6.c | 14 +------ sys/netinet6/esp_input.c | 66 +------------------------------- sys/netinet6/frag6.c | 9 +---- sys/netinet6/icmp6.c | 80 +-------------------------------------- sys/netinet6/ip6_input.c | 36 +----------------- sys/netinet6/ip6_mroute.c | 13 +------ sys/netinet6/mld6.c | 9 +---- sys/netinet6/nd6_nbr.c | 14 +------ sys/netinet6/nd6_rtr.c | 14 +------ sys/netinet6/route6.c | 19 +--------- sys/sys/mbuf.h | 5 +-- 16 files changed, 30 insertions(+), 521 deletions(-) diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 7f33091c5c5b..0599998b9ae5 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_loop.c,v 1.43 2003/05/01 07:52:58 itojun Exp $ */ +/* $NetBSD: if_loop.c,v 1.44 2003/05/14 06:47:33 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.43 2003/05/01 07:52:58 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.44 2003/05/14 06:47:33 itojun Exp $"); #include "opt_inet.h" #include "opt_atalk.h" @@ -226,58 +226,6 @@ looutput(ifp, m, dst, rt) rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH); } -#ifndef PULLDOWN_TEST - /* - * KAME requires that the packet to be contiguous on the - * mbuf. We need to make that sure. - * this kind of code should be avoided. - * XXX other conditions to avoid running this part? - */ - if (m->m_len != m->m_pkthdr.len) { - struct mbuf *n = NULL; - int maxlen; - - MGETHDR(n, M_DONTWAIT, MT_HEADER); - maxlen = MHLEN; - if (n) - M_COPY_PKTHDR(n, m); - if (n && m->m_pkthdr.len > maxlen) { - MCLGET(n, M_DONTWAIT); - maxlen = MCLBYTES; - if ((n->m_flags & M_EXT) == 0) { - m_free(n); - n = NULL; - } - } - if (!n) { - printf("looutput: mbuf allocation failed\n"); - m_freem(m); - return ENOBUFS; - } - - if (m->m_pkthdr.len <= maxlen) { - m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t)); - n->m_len = m->m_pkthdr.len; - n->m_next = NULL; - m_freem(m); - } else { - m_copydata(m, 0, maxlen, mtod(n, caddr_t)); - m_adj(m, maxlen); - n->m_len = maxlen; - n->m_next = m; - m->m_flags &= ~M_PKTHDR; - } - m = n; - } -#if 0 - if (m && m->m_next != NULL) { - printf("loop: not contiguous...\n"); - m_freem(m); - return ENOBUFS; - } -#endif -#endif - ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; diff --git a/sys/netinet/ip6.h b/sys/netinet/ip6.h index 83bbdfcebdfb..46de0d0f5480 100644 --- a/sys/netinet/ip6.h +++ b/sys/netinet/ip6.h @@ -1,4 +1,4 @@ -/* $NetBSD: ip6.h,v 1.13 2002/11/02 07:28:12 perry Exp $ */ +/* $NetBSD: ip6.h,v 1.14 2003/05/14 06:47:35 itojun Exp $ */ /* $KAME: ip6.h,v 1.14 2000/10/09 01:04:09 itojun Exp $ */ /* @@ -207,46 +207,6 @@ struct ip6_frag { #define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/ #ifdef _KERNEL -/* - * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the - * target header (including IPv6 itself, extension headers and - * TCP/UDP/ICMP6 headers) are continuous. KAME requires drivers - * to store incoming data into one internal mbuf or one or more external - * mbufs(never into two or more internal mbufs). Thus, the third case is - * supposed to never be matched but is prepared just in case. - */ - -#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \ -do { \ - if ((m)->m_next != NULL) { \ - if (((m)->m_flags & M_LOOP) && \ - ((m)->m_len < (off) + (hlen)) && \ - (((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \ - ip6stat.ip6s_exthdrtoolong++; \ - return ret; \ - } else if ((m)->m_flags & M_EXT) { \ - if ((m)->m_len < (off) + (hlen)) { \ - ip6stat.ip6s_exthdrtoolong++; \ - m_freem(m); \ - return ret; \ - } \ - } else { \ - if ((m)->m_len < (off) + (hlen)) { \ - ip6stat.ip6s_exthdrtoolong++; \ - m_freem(m); \ - return ret; \ - } \ - } \ - } else { \ - if ((m)->m_len < (off) + (hlen)) { \ - ip6stat.ip6s_tooshort++; \ - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \ - m_freem(m); \ - return ret; \ - } \ - } \ -} while (/*CONSTCOND*/ 0) - /* * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to * "len") is located in single mbuf, on contiguous memory region. diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 7196d67d83c8..f07e1738c805 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_input.c,v 1.163 2003/03/01 04:40:27 thorpej Exp $ */ +/* $NetBSD: tcp_input.c,v 1.164 2003/05/14 06:47:35 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -152,7 +152,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.163 2003/03/01 04:40:27 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.164 2003/05/14 06:47:35 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -195,12 +195,10 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.163 2003/03/01 04:40:27 thorpej Exp #include #endif -#ifdef PULLDOWN_TEST #ifndef INET6 /* always need ip6.h for IP6_EXTHDR_GET */ #include #endif -#endif #include #include @@ -842,21 +840,6 @@ tcp_input(m, va_alist) case 4: af = AF_INET; iphlen = sizeof(struct ip); -#ifndef PULLDOWN_TEST - /* would like to get rid of this... */ - if (toff > sizeof (struct ip)) { - ip_stripoptions(m, (struct mbuf *)0); - toff = sizeof(struct ip); - } - if (m->m_len < toff + sizeof (struct tcphdr)) { - if ((m = m_pullup(m, toff + sizeof (struct tcphdr))) == 0) { - tcpstat.tcps_rcvshort++; - return; - } - } - ip = mtod(m, struct ip *); - th = (struct tcphdr *)(mtod(m, caddr_t) + toff); -#else ip = mtod(m, struct ip *); IP6_EXTHDR_GET(th, struct tcphdr *, m, toff, sizeof(struct tcphdr)); @@ -864,7 +847,6 @@ tcp_input(m, va_alist) tcpstat.tcps_rcvshort++; return; } -#endif /* We do the checksum after PCB lookup... */ len = ntohs(ip->ip_len); tlen = len - toff; @@ -875,17 +857,6 @@ tcp_input(m, va_alist) ip = NULL; iphlen = sizeof(struct ip6_hdr); af = AF_INET6; -#ifndef PULLDOWN_TEST - if (m->m_len < toff + sizeof(struct tcphdr)) { - m = m_pullup(m, toff + sizeof(struct tcphdr)); /*XXX*/ - if (m == NULL) { - tcpstat.tcps_rcvshort++; - return; - } - } - ip6 = mtod(m, struct ip6_hdr *); - th = (struct tcphdr *)(mtod(m, caddr_t) + toff); -#else ip6 = mtod(m, struct ip6_hdr *); IP6_EXTHDR_GET(th, struct tcphdr *, m, toff, sizeof(struct tcphdr)); @@ -893,7 +864,6 @@ tcp_input(m, va_alist) tcpstat.tcps_rcvshort++; return; } -#endif /* Be proactive about malicious use of IPv4 mapped address */ if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || @@ -955,27 +925,6 @@ tcp_input(m, va_alist) */ if (off > sizeof (struct tcphdr)) { -#ifndef PULLDOWN_TEST - if (m->m_len < toff + off) { - if ((m = m_pullup(m, toff + off)) == 0) { - tcpstat.tcps_rcvshort++; - return; - } - switch (af) { -#ifdef INET - case AF_INET: - ip = mtod(m, struct ip *); - break; -#endif -#ifdef INET6 - case AF_INET6: - ip6 = mtod(m, struct ip6_hdr *); - break; -#endif - } - th = (struct tcphdr *)(mtod(m, caddr_t) + toff); - } -#else IP6_EXTHDR_GET(th, struct tcphdr *, m, toff, off); if (th == NULL) { tcpstat.tcps_rcvshort++; @@ -985,7 +934,6 @@ tcp_input(m, va_alist) * NOTE: ip/ip6 will not be affected by m_pulldown() * (as they're before toff) and we don't need to update those. */ -#endif KASSERT(TCP_HDR_ALIGNED_P(th)); optlen = off - sizeof (struct tcphdr); optp = ((u_int8_t *)th) + sizeof(struct tcphdr); @@ -1163,20 +1111,8 @@ findpcb: default: /* Must compute it ourselves. */ TCP_CSUM_COUNTER_INCR(&tcp_swcsum); -#ifndef PULLDOWN_TEST - { - struct ipovly *ipov; - ipov = (struct ipovly *)ip; - bzero(ipov->ih_x1, sizeof ipov->ih_x1); - ipov->ih_len = htons(tlen + off); - - if (in_cksum(m, len) != 0) - goto badcsum; - } -#else if (in4_cksum(m, IPPROTO_TCP, toff, tlen + off) != 0) goto badcsum; -#endif /* ! PULLDOWN_TEST */ break; } break; diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index f7b6314ae30d..a430e3e3a8d4 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.98 2003/02/26 06:31:17 matt Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.99 2003/05/14 06:47:37 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.98 2003/02/26 06:31:17 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.99 2003/05/14 06:47:37 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -106,12 +106,10 @@ __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.98 2003/02/26 06:31:17 matt Exp $") #include #endif -#ifdef PULLDOWN_TEST #ifndef INET6 /* always need ip6.h for IP6_EXTHDR_GET */ #include #endif -#endif #include "faith.h" #if defined(NFAITH) && NFAITH > 0 @@ -236,44 +234,15 @@ udp_input(m, va_alist) MCLAIM(m, &udp_rx_mowner); udpstat.udps_ipackets++; -#ifndef PULLDOWN_TEST - /* - * Strip IP options, if any; should skip this, - * make available to user, and use on returned packets, - * but we don't yet have a way to check the checksum - * with options still present. - */ - if (iphlen > sizeof (struct ip)) { - ip_stripoptions(m, (struct mbuf *)0); - iphlen = sizeof(struct ip); - } -#else - /* - * we may enable the above code if we save and pass IPv4 options - * to the userland. - */ -#endif - /* * Get IP and UDP header together in first mbuf. */ ip = mtod(m, struct ip *); -#ifndef PULLDOWN_TEST - if (m->m_len < iphlen + sizeof(struct udphdr)) { - if ((m = m_pullup(m, iphlen + sizeof(struct udphdr))) == 0) { - udpstat.udps_hdrops++; - return; - } - ip = mtod(m, struct ip *); - } - uh = (struct udphdr *)((caddr_t)ip + iphlen); -#else IP6_EXTHDR_GET(uh, struct udphdr *, m, iphlen, sizeof(struct udphdr)); if (uh == NULL) { udpstat.udps_hdrops++; return; } -#endif KASSERT(UDP_HDR_ALIGNED_P(uh)); /* destination port of 0 is illegal, based on RFC768. */ @@ -406,9 +375,6 @@ udp6_input(mp, offp, proto) struct udphdr *uh; u_int32_t plen, ulen; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); -#endif ip6 = mtod(m, struct ip6_hdr *); #if defined(NFAITH) && 0 < NFAITH @@ -423,15 +389,11 @@ udp6_input(mp, offp, proto) /* check for jumbogram is done in ip6_input. we can trust pkthdr.len */ plen = m->m_pkthdr.len - off; -#ifndef PULLDOWN_TEST - uh = (struct udphdr *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(struct udphdr)); if (uh == NULL) { ip6stat.ip6s_tooshort++; return IPPROTO_DONE; } -#endif KASSERT(UDP_HDR_ALIGNED_P(uh)); ulen = ntohs((u_short)uh->uh_ulen); /* diff --git a/sys/netinet6/ah_input.c b/sys/netinet6/ah_input.c index 998267592dc3..ea53fc9fa6e0 100644 --- a/sys/netinet6/ah_input.c +++ b/sys/netinet6/ah_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: ah_input.c,v 1.37 2002/09/11 03:45:44 itojun Exp $ */ +/* $NetBSD: ah_input.c,v 1.38 2003/05/14 06:47:38 itojun Exp $ */ /* $KAME: ah_input.c,v 1.64 2001/09/04 08:43:19 itojun Exp $ */ /* @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ah_input.c,v 1.37 2002/09/11 03:45:44 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ah_input.c,v 1.38 2003/05/14 06:47:38 itojun Exp $"); #include "opt_inet.h" @@ -114,20 +114,6 @@ ah4_input(m, va_alist) proto = va_arg(ap, int); va_end(ap); -#ifndef PULLDOWN_TEST - if (m->m_len < off + sizeof(struct newah)) { - m = m_pullup(m, off + sizeof(struct newah)); - if (!m) { - ipseclog((LOG_DEBUG, "IPv4 AH input: can't pullup;" - "dropping the packet for simplicity\n")); - ipsecstat.in_inval++; - goto fail; - } - } - - ip = mtod(m, struct ip *); - ah = (struct ah *)(((caddr_t)ip) + off); -#else ip = mtod(m, struct ip *); IP6_EXTHDR_GET(ah, struct ah *, m, off, sizeof(struct newah)); if (ah == NULL) { @@ -136,7 +122,6 @@ ah4_input(m, va_alist) ipsecstat.in_inval++; goto fail; } -#endif nxt = ah->ah_nxt; #ifdef _IP_VHL hlen = IP_VHL_HL(ip->ip_vhl) << 2; @@ -231,19 +216,6 @@ ah4_input(m, va_alist) goto fail; } -#ifndef PULLDOWN_TEST - if (m->m_len < off + sizeof(struct ah) + sizoff + siz1) { - m = m_pullup(m, off + sizeof(struct ah) + sizoff + siz1); - if (!m) { - ipseclog((LOG_DEBUG, "IPv4 AH input: can't pullup\n")); - ipsecstat.in_inval++; - goto fail; - } - - ip = mtod(m, struct ip *); - ah = (struct ah *)(((caddr_t)ip) + off); - } -#else IP6_EXTHDR_GET(ah, struct ah *, m, off, sizeof(struct ah) + sizoff + siz1); if (ah == NULL) { @@ -251,7 +223,6 @@ ah4_input(m, va_alist) ipsecstat.in_inval++; goto fail; } -#endif } /* @@ -469,16 +440,6 @@ ah4_input(m, va_alist) */ ip = mtod(m, struct ip *); -#ifndef PULLDOWN_TEST - /* - * We do deep-copy since KAME requires that - * the packet is placed in a single external mbuf. - */ - ovbcopy((caddr_t)ip, (caddr_t)(((u_char *)ip) + stripsiz), off); - m->m_data += stripsiz; - m->m_len -= stripsiz; - m->m_pkthdr.len -= stripsiz; -#else /* * even in m_pulldown case, we need to strip off AH so that * we can compute checksum for multiple AH correctly. @@ -505,7 +466,6 @@ ah4_input(m, va_alist) /* m_cat does not update m_pkthdr.len */ m->m_pkthdr.len += n->m_pkthdr.len; } -#endif if (m->m_len < sizeof(*ip)) { m = m_pullup(m, sizeof(*ip)); @@ -635,17 +595,12 @@ ah6_input(mp, offp, proto) int s; size_t stripsiz = 0; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(struct ah), IPPROTO_DONE); - ah = (struct ah *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(ah, struct ah *, m, off, sizeof(struct newah)); if (ah == NULL) { ipseclog((LOG_DEBUG, "IPv6 AH input: can't pullup\n")); ipsec6stat.in_inval++; return IPPROTO_DONE; } -#endif ip6 = mtod(m, struct ip6_hdr *); nxt = ah->ah_nxt; @@ -726,9 +681,6 @@ ah6_input(mp, offp, proto) goto fail; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(struct ah) + sizoff + siz1, IPPROTO_DONE); -#else IP6_EXTHDR_GET(ah, struct ah *, m, off, sizeof(struct ah) + sizoff + siz1); if (ah == NULL) { @@ -737,7 +689,6 @@ ah6_input(mp, offp, proto) m = NULL; goto fail; } -#endif } /* @@ -930,16 +881,6 @@ ah6_input(mp, offp, proto) *prvnxtp = nxt; ip6 = mtod(m, struct ip6_hdr *); -#ifndef PULLDOWN_TEST - /* - * We do deep-copy since KAME requires that - * the packet is placed in a single mbuf. - */ - ovbcopy((caddr_t)ip6, ((caddr_t)ip6) + stripsiz, off); - m->m_data += stripsiz; - m->m_len -= stripsiz; - m->m_pkthdr.len -= stripsiz; -#else /* * even in m_pulldown case, we need to strip off AH so that * we can compute checksum for multiple AH correctly. @@ -966,7 +907,6 @@ ah6_input(mp, offp, proto) /* m_cat does not update m_pkthdr.len */ m->m_pkthdr.len += n->m_pkthdr.len; } -#endif ip6 = mtod(m, struct ip6_hdr *); /* XXX jumbogram */ ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) - stripsiz); diff --git a/sys/netinet6/dest6.c b/sys/netinet6/dest6.c index 0a2a452e49d0..4e5ddbb8415b 100644 --- a/sys/netinet6/dest6.c +++ b/sys/netinet6/dest6.c @@ -1,4 +1,4 @@ -/* $NetBSD: dest6.c,v 1.11 2001/11/13 00:56:56 lukem Exp $ */ +/* $NetBSD: dest6.c,v 1.12 2003/05/14 06:47:39 itojun Exp $ */ /* $KAME: dest6.c,v 1.25 2001/02/22 01:39:16 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dest6.c,v 1.11 2001/11/13 00:56:56 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dest6.c,v 1.12 2003/05/14 06:47:39 itojun Exp $"); #include #include @@ -68,24 +68,14 @@ dest6_input(mp, offp, proto) u_int8_t *opt; /* validation of the length of the header */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(*dstopts), IPPROTO_DONE); - dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(dstopts, struct ip6_dest *, m, off, sizeof(*dstopts)); if (dstopts == NULL) return IPPROTO_DONE; -#endif dstoptlen = (dstopts->ip6d_len + 1) << 3; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, dstoptlen, IPPROTO_DONE); - dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(dstopts, struct ip6_dest *, m, off, dstoptlen); if (dstopts == NULL) return IPPROTO_DONE; -#endif off += dstoptlen; dstoptlen -= sizeof(struct ip6_dest); opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest); diff --git a/sys/netinet6/esp_input.c b/sys/netinet6/esp_input.c index 1526690315f4..3546f0d87ed1 100644 --- a/sys/netinet6/esp_input.c +++ b/sys/netinet6/esp_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp_input.c,v 1.28 2003/01/20 00:39:30 simonb Exp $ */ +/* $NetBSD: esp_input.c,v 1.29 2003/05/14 06:47:39 itojun Exp $ */ /* $KAME: esp_input.c,v 1.60 2001/09/04 08:43:19 itojun Exp $ */ /* @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esp_input.c,v 1.28 2003/01/20 00:39:30 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esp_input.c,v 1.29 2003/05/14 06:47:39 itojun Exp $"); #include "opt_inet.h" @@ -543,16 +543,11 @@ esp6_input(mp, offp, proto) goto bad; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, ESPMAXLEN, IPPROTO_DONE); - esp = (struct esp *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(esp, struct esp *, m, off, ESPMAXLEN); if (esp == NULL) { ipsec6stat.in_inval++; return IPPROTO_DONE; } -#endif ip6 = mtod(m, struct ip6_hdr *); if (ntohs(ip6->ip6_plen) == 0) { @@ -702,16 +697,12 @@ noreplaycheck: goto bad; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, esplen + ivlen, IPPROTO_DONE); /* XXX */ -#else IP6_EXTHDR_GET(esp, struct esp *, m, off, esplen + ivlen); if (esp == NULL) { ipsec6stat.in_inval++; m = NULL; goto bad; } -#endif ip6 = mtod(m, struct ip6_hdr *); /* set it again just in case */ /* @@ -774,14 +765,7 @@ noreplaycheck: flowinfo = ip6->ip6_flow; m_adj(m, off + esplen + ivlen); if (m->m_len < sizeof(*ip6)) { -#ifndef PULLDOWN_TEST - /* - * m_pullup is prohibited in KAME IPv6 input processing - * but there's no other way! - */ -#else /* okay to pullup in m_pulldown style */ -#endif m = m_pullup(m, sizeof(*ip6)); if (!m) { ipsec6stat.in_inval++; @@ -860,52 +844,6 @@ noreplaycheck: m->m_pkthdr.len += n->m_pkthdr.len; } -#ifndef PULLDOWN_TEST - /* - * KAME requires that the packet to be contiguous on the - * mbuf. We need to make that sure. - * this kind of code should be avoided. - * XXX other conditions to avoid running this part? - */ - if (m->m_len != m->m_pkthdr.len) { - struct mbuf *n = NULL; - int maxlen; - - MGETHDR(n, M_DONTWAIT, MT_HEADER); - maxlen = MHLEN; - if (n) - M_COPY_PKTHDR(n, m); - if (n && m->m_pkthdr.len > maxlen) { - MCLGET(n, M_DONTWAIT); - maxlen = MCLBYTES; - if ((n->m_flags & M_EXT) == 0) { - m_free(n); - n = NULL; - } - } - if (!n) { - printf("esp6_input: mbuf allocation failed\n"); - goto bad; - } - - if (m->m_pkthdr.len <= maxlen) { - m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t)); - n->m_len = m->m_pkthdr.len; - n->m_pkthdr.len = m->m_pkthdr.len; - n->m_next = NULL; - m_freem(m); - } else { - m_copydata(m, 0, maxlen, mtod(n, caddr_t)); - m_adj(m, maxlen); - n->m_len = maxlen; - n->m_pkthdr.len = m->m_pkthdr.len; - n->m_next = m; - m->m_flags &= ~M_PKTHDR; - } - m = n; - } -#endif - ip6 = mtod(m, struct ip6_hdr *); ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) - stripsiz); diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index b970efbbdc23..a59039f41314 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,4 +1,4 @@ -/* $NetBSD: frag6.c,v 1.23 2002/11/02 07:30:55 perry Exp $ */ +/* $NetBSD: frag6.c,v 1.24 2003/05/14 06:47:39 itojun Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.23 2002/11/02 07:30:55 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.24 2003/05/14 06:47:39 itojun Exp $"); #include #include @@ -196,14 +196,9 @@ frag6_input(mp, offp, proto) #endif ip6 = mtod(m, struct ip6_hdr *); -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, offset, sizeof(struct ip6_frag), IPPROTO_DONE); - ip6f = (struct ip6_frag *)((caddr_t)ip6 + offset); -#else IP6_EXTHDR_GET(ip6f, struct ip6_frag *, m, offset, sizeof(*ip6f)); if (ip6f == NULL) return IPPROTO_DONE; -#endif dstifp = NULL; #ifdef IN6_IFSTAT_STRICT diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 60b9c897f073..dbb6ed2ecf2b 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $NetBSD: icmp6.c,v 1.89 2003/03/31 23:55:46 itojun Exp $ */ +/* $NetBSD: icmp6.c,v 1.90 2003/05/14 06:47:40 itojun Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.89 2003/03/31 23:55:46 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.90 2003/05/14 06:47:40 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -279,15 +279,11 @@ icmp6_error(m, type, code, param) goto freeit; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), ); -#else if (m->m_len < sizeof(struct ip6_hdr)) { m = m_pullup(m, sizeof(struct ip6_hdr)); if (m == NULL) return; } -#endif oip6 = mtod(m, struct ip6_hdr *); /* @@ -325,17 +321,12 @@ icmp6_error(m, type, code, param) if (off >= 0 && nxt == IPPROTO_ICMPV6) { struct icmp6_hdr *icp; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, off + sizeof(struct icmp6_hdr), ); - icp = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(icp, struct icmp6_hdr *, m, off, sizeof(*icp)); if (icp == NULL) { icmp6stat.icp6s_tooshort++; return; } -#endif if (icp->icmp6_type < ICMP6_ECHO_REQUEST || icp->icmp6_type == ND_REDIRECT) { /* @@ -439,11 +430,6 @@ icmp6_input(mp, offp, proto) icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_msg); -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE); - /* m might change if M_LOOP. So, call mtod after this */ -#endif - /* * Locate icmp6 structure in mbuf, and check * that not corrupted and of at least minimum length @@ -459,16 +445,12 @@ icmp6_input(mp, offp, proto) /* * calculate the checksum */ -#ifndef PULLDOWN_TEST - icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6)); if (icmp6 == NULL) { icmp6stat.icp6s_tooshort++; icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error); return IPPROTO_DONE; } -#endif KASSERT(IP6_HDR_ALIGNED_P(icmp6)); code = icmp6->icmp6_code; @@ -712,10 +694,6 @@ icmp6_input(mp, offp, proto) goto badlen; if (mode == FQDN) { -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo), - IPPROTO_DONE); -#endif n = m_copym(m, 0, M_COPYALL, M_DONTWAIT); if (n) n = ni6_input(n, off); @@ -925,19 +903,12 @@ icmp6_notify_error(m, off, icmp6len, code) icmp6stat.icp6s_tooshort++; goto freeit; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, - sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr), - -1); - icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6) + sizeof(struct ip6_hdr)); if (icmp6 == NULL) { icmp6stat.icp6s_tooshort++; return (-1); } -#endif eip6 = (struct ip6_hdr *)(icmp6 + 1); /* Detect the upper level protocol */ @@ -961,20 +932,12 @@ icmp6_notify_error(m, off, icmp6len, code) case IPPROTO_HOPOPTS: case IPPROTO_DSTOPTS: case IPPROTO_AH: -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, eoff + - sizeof(struct ip6_ext), - -1); - eh = (struct ip6_ext *)(mtod(m, caddr_t) - + eoff); -#else IP6_EXTHDR_GET(eh, struct ip6_ext *, m, eoff, sizeof(*eh)); if (eh == NULL) { icmp6stat.icp6s_tooshort++; return (-1); } -#endif if (nxt == IPPROTO_AH) eoff += (eh->ip6e_len + 2) << 2; @@ -991,19 +954,12 @@ icmp6_notify_error(m, off, icmp6len, code) * information that depends on the final * destination (e.g. path MTU). */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, eoff + sizeof(*rth), - -1); - rth = (struct ip6_rthdr *)(mtod(m, caddr_t) - + eoff); -#else IP6_EXTHDR_GET(rth, struct ip6_rthdr *, m, eoff, sizeof(*rth)); if (rth == NULL) { icmp6stat.icp6s_tooshort++; return (-1); } -#endif rthlen = (rth->ip6r_len + 1) << 3; /* * XXX: currently there is no @@ -1017,11 +973,6 @@ icmp6_notify_error(m, off, icmp6len, code) rth->ip6r_type == IPV6_RTHDR_TYPE_0) { int hops; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, eoff + rthlen, - -1); - rth0 = (struct ip6_rthdr0 *)(mtod(m, caddr_t) + eoff); -#else IP6_EXTHDR_GET(rth0, struct ip6_rthdr0 *, m, eoff, rthlen); @@ -1029,7 +980,6 @@ icmp6_notify_error(m, off, icmp6len, code) icmp6stat.icp6s_tooshort++; return (-1); } -#endif /* just ignore a bogus header */ if ((rth0->ip6r0_len % 2) == 0 && (hops = rth0->ip6r0_len/2)) @@ -1039,20 +989,12 @@ icmp6_notify_error(m, off, icmp6len, code) nxt = rth->ip6r_nxt; break; case IPPROTO_FRAGMENT: -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, 0, eoff + - sizeof(struct ip6_frag), - -1); - fh = (struct ip6_frag *)(mtod(m, caddr_t) - + eoff); -#else IP6_EXTHDR_GET(fh, struct ip6_frag *, m, eoff, sizeof(*fh)); if (fh == NULL) { icmp6stat.icp6s_tooshort++; return (-1); } -#endif /* * Data after a fragment header is meaningless * unless it is the first fragment, but @@ -1078,16 +1020,12 @@ icmp6_notify_error(m, off, icmp6len, code) } } notify: -#ifndef PULLDOWN_TEST - icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6) + sizeof(struct ip6_hdr)); if (icmp6 == NULL) { icmp6stat.icp6s_tooshort++; return (-1); } -#endif eip6 = (struct ip6_hdr *)(icmp6 + 1); bzero(&icmp6dst, sizeof(icmp6dst)); @@ -1259,15 +1197,11 @@ ni6_input(m, off) char *subj = NULL; ip6 = mtod(m, struct ip6_hdr *); -#ifndef PULLDOWN_TEST - ni6 = (struct icmp6_nodeinfo *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(ni6, struct icmp6_nodeinfo *, m, off, sizeof(*ni6)); if (ni6 == NULL) { /* m is already reclaimed */ return NULL; } -#endif /* * Validate IPv6 destination address. @@ -1972,16 +1906,11 @@ icmp6_rip6_input(mp, off) struct icmp6_hdr *icmp6; struct mbuf *opts = NULL; -#ifndef PULLDOWN_TEST - /* this is assumed to be safe. */ - icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6)); if (icmp6 == NULL) { /* m is already reclaimed */ return IPPROTO_DONE; } -#endif bzero(&rip6src, sizeof(rip6src)); rip6src.sin6_len = sizeof(struct sockaddr_in6); @@ -2282,16 +2211,11 @@ icmp6_redirect_input(m, off) if (!icmp6_rediraccept) goto freeit; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(nd_rd, struct nd_redirect *, m, off, icmp6len); if (nd_rd == NULL) { icmp6stat.icp6s_tooshort++; return; } -#endif redtgt6 = nd_rd->nd_rd_target; reddst6 = nd_rd->nd_rd_dst; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 0b6687fdc1be..123bb0986255 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.60 2003/01/20 05:30:11 simonb Exp $ */ +/* $NetBSD: ip6_input.c,v 1.61 2003/05/14 06:47:41 itojun Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.60 2003/01/20 05:30:11 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.61 2003/05/14 06:47:41 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -264,11 +264,6 @@ ip6_input(m) in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); ip6stat.ip6s_total++; -#ifndef PULLDOWN_TEST - /* XXX is the line really necessary? */ - IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), /*nothing*/); -#endif - /* * If the IPv6 header is not aligned, slurp it up into a new * mbuf with space for link headers, in the event we forward @@ -628,17 +623,12 @@ ip6_input(m) (caddr_t)&ip6->ip6_plen - (caddr_t)ip6); return; } -#ifndef PULLDOWN_TEST - /* ip6_hopopts_input() ensures that mbuf is contiguous */ - hbh = (struct ip6_hbh *)(ip6 + 1); -#else IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); if (hbh == NULL) { ip6stat.ip6s_tooshort++; return; } -#endif KASSERT(IP6_HDR_ALIGNED_P(hbh)); nxt = hbh->ip6h_nxt; @@ -782,14 +772,6 @@ ip6_hopopts_input(plenp, rtalertp, mp, offp) u_int8_t *opt; /* validation of the length of the header */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(*hbh), -1); - hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); - hbhlen = (hbh->ip6h_len + 1) << 3; - - IP6_EXTHDR_CHECK(m, off, hbhlen, -1); - hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); if (hbh == NULL) { @@ -803,7 +785,6 @@ ip6_hopopts_input(plenp, rtalertp, mp, offp) ip6stat.ip6s_tooshort++; return -1; } -#endif KASSERT(IP6_HDR_ALIGNED_P(hbh)); off += hbhlen; hbhlen -= sizeof(struct ip6_hbh); @@ -1095,10 +1076,6 @@ ip6_savecontrol(in6p, mp, ip6, m) struct ip6_hbh *hbh; int hbhlen; -#ifndef PULLDOWN_TEST - hbh = (struct ip6_hbh *)(ip6 + 1); - hbhlen = (hbh->ip6h_len + 1) << 3; -#else IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); if (hbh == NULL) { @@ -1112,7 +1089,6 @@ ip6_savecontrol(in6p, mp, ip6, m) ip6stat.ip6s_tooshort++; return; } -#endif /* * XXX: We copy whole the header even if a jumbo @@ -1143,13 +1119,6 @@ ip6_savecontrol(in6p, mp, ip6, m) struct ip6_ext *ip6e; int elen; -#ifndef PULLDOWN_TEST - ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + off); - if (nxt == IPPROTO_AH) - elen = (ip6e->ip6e_len + 2) << 2; - else - elen = (ip6e->ip6e_len + 1) << 3; -#else IP6_EXTHDR_GET(ip6e, struct ip6_ext *, m, off, sizeof(struct ip6_ext)); if (ip6e == NULL) { @@ -1165,7 +1134,6 @@ ip6_savecontrol(in6p, mp, ip6, m) ip6stat.ip6s_tooshort++; return; } -#endif KASSERT(IP6_HDR_ALIGNED_P(ip6e)); switch (nxt) { diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index ed95aa59a115..30d8b8aaed00 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_mroute.c,v 1.41 2002/11/27 05:09:36 itojun Exp $ */ +/* $NetBSD: ip6_mroute.c,v 1.42 2003/05/14 06:47:42 itojun Exp $ */ /* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */ /* @@ -85,7 +85,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.41 2002/11/27 05:09:36 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.42 2003/05/14 06:47:42 itojun Exp $"); #include "opt_inet.h" @@ -1665,20 +1665,11 @@ pim6_input(mp, offp, proto) * Make sure that the IP6 and PIM headers in contiguous memory, and * possibly the PIM REGISTER header */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, minlen, IPPROTO_DONE); - /* adjust pointer */ - ip6 = mtod(m, struct ip6_hdr *); - - /* adjust mbuf to point to the PIM header */ - pim = (struct pim *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(pim, struct pim *, m, off, minlen); if (pim == NULL) { pim6stat.pim6s_rcv_tooshort++; return IPPROTO_DONE; } -#endif #define PIM6_CHECKSUM #ifdef PIM6_CHECKSUM diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index fbca5f9e43a6..3fb848f583de 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $NetBSD: mld6.c,v 1.20 2002/06/09 14:43:13 itojun Exp $ */ +/* $NetBSD: mld6.c,v 1.21 2003/05/14 06:47:43 itojun Exp $ */ /* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */ /* @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.20 2002/06/09 14:43:13 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.21 2003/05/14 06:47:43 itojun Exp $"); #include "opt_inet.h" @@ -194,16 +194,11 @@ mld6_input(m, off) struct in6_ifaddr *ia; int timer; /* timer value in the MLD query header */ -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(*mldh),); - mldh = (struct mld6_hdr *)(mtod(m, caddr_t) + off); -#else IP6_EXTHDR_GET(mldh, struct mld6_hdr *, m, off, sizeof(*mldh)); if (mldh == NULL) { icmp6stat.icp6s_tooshort++; return; } -#endif /* source address validation */ ip6 = mtod(m, struct ip6_hdr *);/* in case mpullup */ diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index f34faf9b60c3..0d7cd05e8c1c 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_nbr.c,v 1.43 2002/09/23 05:51:16 simonb Exp $ */ +/* $NetBSD: nd6_nbr.c,v 1.44 2003/05/14 06:47:44 itojun Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.43 2002/09/23 05:51:16 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.44 2003/05/14 06:47:44 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -110,16 +110,11 @@ nd6_ns_input(m, off, icmp6len) union nd_opts ndopts; struct sockaddr_dl *proxydl = NULL; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(nd_ns, struct nd_neighbor_solicit *, m, off, icmp6len); if (nd_ns == NULL) { icmp6stat.icp6s_tooshort++; return; } -#endif ip6 = mtod(m, struct ip6_hdr *); /* adjust pointer for safety */ taddr6 = nd_ns->nd_ns_target; @@ -574,16 +569,11 @@ nd6_na_input(m, off, icmp6len) goto bad; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_na = (struct nd_neighbor_advert *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(nd_na, struct nd_neighbor_advert *, m, off, icmp6len); if (nd_na == NULL) { icmp6stat.icp6s_tooshort++; return; } -#endif taddr6 = nd_na->nd_na_target; flags = nd_na->nd_na_flags_reserved; is_router = ((flags & ND_NA_FLAG_ROUTER) != 0); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 2ad01611fd4f..6a5ce384b46e 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_rtr.c,v 1.37 2003/05/08 20:08:52 itojun Exp $ */ +/* $NetBSD: nd6_rtr.c,v 1.38 2003/05/14 06:47:45 itojun Exp $ */ /* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.37 2003/05/08 20:08:52 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.38 2003/05/14 06:47:45 itojun Exp $"); #include #include @@ -136,16 +136,11 @@ nd6_rs_input(m, off, icmp6len) if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) goto freeit; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_rs = (struct nd_router_solicit *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(nd_rs, struct nd_router_solicit *, m, off, icmp6len); if (nd_rs == NULL) { icmp6stat.icp6s_tooshort++; return; } -#endif icmp6len -= sizeof(*nd_rs); nd6_option_init(nd_rs + 1, icmp6len, &ndopts); @@ -231,16 +226,11 @@ nd6_ra_input(m, off, icmp6len) goto bad; } -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, icmp6len,); - nd_ra = (struct nd_router_advert *)((caddr_t)ip6 + off); -#else IP6_EXTHDR_GET(nd_ra, struct nd_router_advert *, m, off, icmp6len); if (nd_ra == NULL) { icmp6stat.icp6s_tooshort++; return; } -#endif icmp6len -= sizeof(*nd_ra); nd6_option_init(nd_ra + 1, icmp6len, &ndopts); diff --git a/sys/netinet6/route6.c b/sys/netinet6/route6.c index 8e16d5845fe8..6d6990c181e5 100644 --- a/sys/netinet6/route6.c +++ b/sys/netinet6/route6.c @@ -1,4 +1,4 @@ -/* $NetBSD: route6.c,v 1.11 2002/09/11 02:46:47 itojun Exp $ */ +/* $NetBSD: route6.c,v 1.12 2003/05/14 06:47:46 itojun Exp $ */ /* $KAME: route6.c,v 1.22 2000/12/03 00:54:00 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: route6.c,v 1.11 2002/09/11 02:46:47 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: route6.c,v 1.12 2003/05/14 06:47:46 itojun Exp $"); #include #include @@ -61,30 +61,16 @@ route6_input(mp, offp, proto) struct ip6_rthdr *rh; int off = *offp, rhlen; -#ifndef PULLDOWN_TEST - IP6_EXTHDR_CHECK(m, off, sizeof(*rh), IPPROTO_DONE); - ip6 = mtod(m, struct ip6_hdr *); - rh = (struct ip6_rthdr *)((caddr_t)ip6 + off); -#else ip6 = mtod(m, struct ip6_hdr *); IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh)); if (rh == NULL) { ip6stat.ip6s_tooshort++; return IPPROTO_DONE; } -#endif switch (rh->ip6r_type) { case IPV6_RTHDR_TYPE_0: rhlen = (rh->ip6r_len + 1) << 3; -#ifndef PULLDOWN_TEST - /* - * note on option length: - * due to IP6_EXTHDR_CHECK assumption, we cannot handle - * very big routing header (max rhlen == 2048). - */ - IP6_EXTHDR_CHECK(m, off, rhlen, IPPROTO_DONE); -#else /* * note on option length: * maximum rhlen: 2048 @@ -98,7 +84,6 @@ route6_input(mp, offp, proto) ip6stat.ip6s_tooshort++; return IPPROTO_DONE; } -#endif if (ip6_rthdr0(m, ip6, (struct ip6_rthdr0 *)rh)) return (IPPROTO_DONE); break; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index a8b1b6faa18e..249c569514d3 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $NetBSD: mbuf.h,v 1.82 2003/04/17 16:15:36 scw Exp $ */ +/* $NetBSD: mbuf.h,v 1.83 2003/05/14 06:47:46 itojun Exp $ */ /*- * Copyright (c) 1996, 1997, 1999, 2001 The NetBSD Foundation, Inc. @@ -795,9 +795,6 @@ struct mbstat { } #ifdef _KERNEL -/* always use m_pulldown codepath for KAME IPv6/IPsec */ -#define PULLDOWN_TEST - extern struct mbstat mbstat; extern int nmbclusters; /* limit on the # of clusters */ extern int mblowat; /* mbuf low water mark */