From 99ba58c674b16af00f55405695a33726bb620f4d Mon Sep 17 00:00:00 2001 From: mpi Date: Tue, 19 Jul 2016 08:13:45 +0000 Subject: [PATCH] Use a flag to indicate that a packet has been received on an IPv6 anycast address. This will allow us to split ip6_input() in two parts using a queue in the middle. ok jca@, florian@, bluhm@ --- share/man/man9/mbuf.9 | 10 ++++------ sys/netinet6/ip6_input.c | 8 ++++---- sys/sys/mbuf.h | 8 ++++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 index a663f801599..1508832cbb5 100644 --- a/share/man/man9/mbuf.9 +++ b/share/man/man9/mbuf.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mbuf.9,v 1.99 2016/04/08 10:01:12 dlg Exp $ +.\" $OpenBSD: mbuf.9,v 1.100 2016/07/19 08:13:46 mpi Exp $ .\" .\" Copyright (c) 2001 Jean-Jacques Bernard-Gundol .\" All rights reserved. @@ -25,7 +25,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: April 8 2016 $ +.Dd $Mdocdate: July 19 2016 $ .Dt MGET 9 .Os .Sh NAME @@ -294,10 +294,8 @@ protocol-specific. variable is valid. .It Dv M_LOOP for mbuf statistics. -.It Dv M_FILDROP -dropped by -.Xr bpf 4 -filter. +.It Dv M_ACAST +received as IPv6 anycast. .It Dv M_BCAST packet send/received as link-level broadcast. .It Dv M_MCAST diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 882d660c77e..7d4966e980c 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.164 2016/07/18 19:50:49 bluhm Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.165 2016/07/19 08:13:46 mpi Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -197,7 +197,7 @@ ip6_input(struct mbuf *m) #if NPF > 0 struct in6_addr odst; #endif - int srcrt = 0, isanycast = 0; + int srcrt = 0; ifp = if_get(m->m_pkthdr.ph_ifidx); if (ifp == NULL) @@ -450,7 +450,7 @@ ip6_input(struct mbuf *m) struct in6_ifaddr *ia6 = ifatoia6(ip6_forward_rt.ro_rt->rt_ifa); if (ia6->ia6_flags & IN6_IFF_ANYCAST) - isanycast = 1; + m->m_flags |= M_ACAST; /* * packets to a tentative, duplicated, or somehow invalid * address must not be accepted. @@ -552,7 +552,7 @@ ip6_input(struct mbuf *m) } /* draft-itojun-ipv6-tcp-to-anycast */ - if (isanycast && nxt == IPPROTO_TCP) { + if (ISSET(m->m_flags, M_ACAST) && (nxt == IPPROTO_TCP)) { if (m->m_len >= sizeof(struct ip6_hdr)) { icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR, diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 35f42b41790..df56ea8d91a 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.215 2016/06/13 21:24:43 bluhm Exp $ */ +/* $OpenBSD: mbuf.h,v 1.216 2016/07/19 08:13:45 mpi Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -184,7 +184,7 @@ struct mbuf { /* mbuf pkthdr flags, also in m_flags */ #define M_VLANTAG 0x0020 /* ether_vtag is valid */ #define M_LOOP 0x0040 /* for Mbuf statistics */ -#define M_FILDROP 0x0080 /* dropped by bpf filter */ +#define M_ACAST 0x0080 /* received as IPv6 anycast */ #define M_BCAST 0x0100 /* send/received as link-level broadcast */ #define M_MCAST 0x0200 /* send/received as link-level multicast */ #define M_CONF 0x0400 /* payload was encrypted (ESP-transport) */ @@ -197,13 +197,13 @@ struct mbuf { #ifdef _KERNEL #define M_BITS \ ("\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_EXTWR\5M_PROTO1\6M_VLANTAG\7M_LOOP" \ - "\10M_FILDROP\11M_BCAST\12M_MCAST\13M_CONF\14M_AUTH\15M_TUNNEL" \ + "\10M_ACAST\11M_BCAST\12M_MCAST\13M_CONF\14M_AUTH\15M_TUNNEL" \ "\16M_ZEROIZE\17M_COMP\20M_LINK0") #endif /* flags copied when copying m_pkthdr */ #define M_COPYFLAGS (M_PKTHDR|M_EOR|M_PROTO1|M_BCAST|M_MCAST|M_CONF|M_COMP|\ - M_AUTH|M_LOOP|M_TUNNEL|M_LINK0|M_VLANTAG|M_FILDROP|\ + M_AUTH|M_LOOP|M_TUNNEL|M_LINK0|M_VLANTAG|M_ACAST|\ M_ZEROIZE) /* Checksumming flags */ -- 2.20.1