diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-06-18 06:24:46 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-06-18 06:24:46 +0000 |
commit | 82e9b50a5bf52ea5b38386dcb38e8313248ce627 (patch) | |
tree | ac56c2dae02f812f499bf68c9a16b916d3259ed5 /sys | |
parent | b672eae5ccdbbdec72ab25962e2c17e75e416de2 (diff) |
move m_pullup2() equivalent for KAME requirement into ip6_input().
it was in looutput() to make KAME ipsec4 happy.
however, since we don't have KAME ipsec4 in openbsd, we don't need it
in looutput().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_loop.c | 50 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 18 |
2 files changed, 18 insertions, 50 deletions
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 6a127b4b759..f947e090ed6 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.13 2000/02/07 06:09:08 itojun Exp $ */ +/* $OpenBSD: if_loop.c,v 1.14 2000/06/18 06:24:45 itojun Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -218,54 +218,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->m_next != NULL) { - struct mbuf *n; - - MGETHDR(n, M_DONTWAIT, MT_HEADER); - if (n) { - MCLGET(n, M_DONTWAIT); - 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; - } - - n->m_pkthdr.rcvif = m->m_pkthdr.rcvif; - n->m_pkthdr.len = m->m_pkthdr.len; - if (m->m_pkthdr.len <= MCLBYTES) { - m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t)); - n->m_len = m->m_pkthdr.len; - m_freem(m); - } else { - m_copydata(m, 0, MCLBYTES, mtod(n, caddr_t)); - m_adj(m, MCLBYTES); - n->m_len = MCLBYTES; - 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; switch (dst->sa_family) { diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index c2ba342e223..71456275768 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.14 2000/06/18 04:33:03 itojun Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.15 2000/06/18 06:24:45 itojun Exp $ */ /* $KAME: ip6_input.c,v 1.94 2000/06/13 10:06:19 jinmei Exp $ */ /* @@ -210,6 +210,22 @@ ip6intr() splx(s); if (m == 0) return; +#ifndef PULLDOWN_TEST + /* + * KAME requirement: make sure mbuf is packed well + */ + + if (m->m_next) { + int l; + if (m->m_pkthdr.len > MCLBYTES) + l = MCLBYTES; + else + l = m->m_pkthdr.len; + m = m_pullup2(m, l); + if (!m) + continue; + } +#endif ip6_input(m); } } |