diff options
-rw-r--r-- | sys/netinet/tcp_input.c | 17 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 19 | ||||
-rw-r--r-- | sys/sys/mbuf.h | 6 |
3 files changed, 18 insertions, 24 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index aeeb13f569f..cd63922fe2b 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.223 2008/10/10 20:03:42 dhill Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.224 2008/11/02 10:37:29 claudio Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -342,21 +342,6 @@ tcp6_input(struct mbuf **mp, int *offp, int proto) } #endif - /* - * draft-itojun-ipv6-tcp-to-anycast - * better place to put this in? - */ - if (m->m_flags & M_ANYCAST6) { - if (m->m_len >= sizeof(struct ip6_hdr)) { - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); - icmp6_error(m, ICMP6_DST_UNREACH, - ICMP6_DST_UNREACH_ADDR, - (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); - } else - m_freem(m); - return IPPROTO_DONE; - } - tcp_input(m, *offp, proto); return IPPROTO_DONE; } diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 41e2e68edac..f5216ceaa5f 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.88 2008/10/15 19:12:18 blambert Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.89 2008/11/02 10:37:29 claudio Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -210,7 +210,7 @@ ip6_input(struct mbuf *m) #if NPF > 0 struct in6_addr odst; #endif - int srcrt = 0, rtableid = 0; + int srcrt = 0, rtableid = 0, isanycast = 0; /* * mbuf statistics by kazu @@ -496,7 +496,7 @@ ip6_input(struct mbuf *m) struct in6_ifaddr *ia6 = (struct in6_ifaddr *)ip6_forward_rt.ro_rt->rt_ifa; if (ia6->ia6_flags & IN6_IFF_ANYCAST) - m->m_flags |= M_ANYCAST6; + isanycast = 1; /* * packets to a tentative, duplicated, or somehow invalid * address must not be accepted. @@ -716,6 +716,18 @@ ip6_input(struct mbuf *m) goto bad; } + /* draft-itojun-ipv6-tcp-to-anycast */ + if (isanycast && nxt == IPPROTO_TCP) { + if (m->m_len >= sizeof(struct ip6_hdr)) { + ip6 = mtod(m, struct ip6_hdr *); + icmp6_error(m, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_ADDR, + (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); + break; + } else + goto bad; + } + nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt); } return; @@ -723,7 +735,6 @@ ip6_input(struct mbuf *m) m_freem(m); } - /* scan packet for RH0 routing header. Mostly stolen from pf.c:pf_test6() */ int ip6_check_rh0hdr(struct mbuf *m) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index fe0162bbd1a..0026492ca38 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.105 2008/10/17 19:06:01 claudio Exp $ */ +/* $OpenBSD: mbuf.h,v 1.106 2008/11/02 10:37:29 claudio Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -161,13 +161,11 @@ struct mbuf { #define M_AUTH 0x0800 /* payload was authenticated (AH or ESP auth) */ #define M_TUNNEL 0x1000 /* IP-in-IP added by tunnel mode IPsec */ #define M_AUTH_AH 0x2000 /* header was authenticated (AH) */ -#define M_ANYCAST6 0x4000 /* received as IPv6 anycast */ #define M_LINK0 0x8000 /* link layer specific flag */ /* flags copied when copying m_pkthdr */ #define M_COPYFLAGS (M_PKTHDR|M_EOR|M_PROTO1|M_BCAST|M_MCAST|M_CONF|\ - M_AUTH|M_ANYCAST6|M_LOOP|M_TUNNEL|M_LINK0|M_VLANTAG|\ - M_FILDROP) + M_AUTH|M_LOOP|M_TUNNEL|M_LINK0|M_VLANTAG|M_FILDROP) /* Checksumming flags */ #define M_IPV4_CSUM_OUT 0x0001 /* IPv4 checksum needed */ |