diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-11-02 10:37:30 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-11-02 10:37:30 +0000 |
commit | ed999272ebd7f53d0236922c4a3fc81d433b3c4f (patch) | |
tree | aed3227f4980a68976499de5461753133f898b2b /sys/netinet6 | |
parent | addb1314ab5e1e8134b2b98e77386470ce812098 (diff) |
Remove the M_ANYCAST6 mbuf flag by doing the detection all in ip6_input().
M_ANYCAST6 was only used to signal tcp6_input() that it should drop the
packet and send back icmp error. This can be done in ip6_input() without
the need for a mbuf flag. Gives us back one slot in m_flags for possible
future need. Looked at and some input by naddy@ and henning@. OK dlg@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/ip6_input.c | 19 |
1 files changed, 15 insertions, 4 deletions
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) |