Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys always use PULLDOWN_TEST codepath.
details: https://anonhg.NetBSD.org/src/rev/d2abfa0ea466
branches: trunk
changeset: 547132:d2abfa0ea466
user: itojun <itojun%NetBSD.org@localhost>
date: Wed May 14 06:47:33 2003 +0000
description:
always use PULLDOWN_TEST codepath.
diffstat:
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(-)
diffs (truncated from 1363 to 300 lines):
diff -r eb617c8220c7 -r d2abfa0ea466 sys/net/if_loop.c
--- a/sys/net/if_loop.c Wed May 14 00:30:26 2003 +0000
+++ b/sys/net/if_loop.c Wed May 14 06:47:33 2003 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
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 -r eb617c8220c7 -r d2abfa0ea466 sys/netinet/ip6.h
--- a/sys/netinet/ip6.h Wed May 14 00:30:26 2003 +0000
+++ b/sys/netinet/ip6.h Wed May 14 06:47:33 2003 +0000
@@ -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 $ */
/*
@@ -208,46 +208,6 @@
#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.
* The pointer to the region will be returned to pointer variable "val",
diff -r eb617c8220c7 -r d2abfa0ea466 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c Wed May 14 00:30:26 2003 +0000
+++ b/sys/netinet/tcp_input.c Wed May 14 06:47:33 2003 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
#include <netinet6/nd6.h>
#endif
-#ifdef PULLDOWN_TEST
#ifndef INET6
/* always need ip6.h for IP6_EXTHDR_GET */
#include <netinet/ip6.h>
#endif
-#endif
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
@@ -842,21 +840,6 @@
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 @@
tcpstat.tcps_rcvshort++;
return;
}
-#endif
/* We do the checksum after PCB lookup... */
len = ntohs(ip->ip_len);
tlen = len - toff;
@@ -875,17 +857,6 @@
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 @@
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 @@
*/
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 @@
* 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 @@
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 -r eb617c8220c7 -r d2abfa0ea466 sys/netinet/udp_usrreq.c
--- a/sys/netinet/udp_usrreq.c Wed May 14 00:30:26 2003 +0000
+++ b/sys/netinet/udp_usrreq.c Wed May 14 06:47:33 2003 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
#include <netinet6/udp6_var.h>
#endif
-#ifdef PULLDOWN_TEST
Home |
Main Index |
Thread Index |
Old Index