summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2020-08-02 11:15:51 +0000
committerkn <kn@openbsd.org>2020-08-02 11:15:51 +0000
commit30c05804b39c94b2c8ee4e8c592c5ff5d6aeb33a (patch)
treea100e939e266b6ce7ae9946d457a0a942b1e0d30
parentMake iwx(4) match any AX200 device again. (diff)
downloadwireguard-openbsd-30c05804b39c94b2c8ee4e8c592c5ff5d6aeb33a.tar.xz
wireguard-openbsd-30c05804b39c94b2c8ee4e8c592c5ff5d6aeb33a.zip
Add missing rtable(4) check in rip6_input()
Copied over from sys/netinet/raw_ip.c:rip_input() where it appeared with initial support for multiple routing tables. This enforces separation between multiple raw sockets in different routing tables, i.e. one must not see packets from the other if the rtable differs. Observed with ping6(8)'s "-v" showing all ICMPv6 packets on its raw socket including those produced by another ping6 with "-V1". florian reported IPv6 route advertisments in one routing table appearing on raw sockets in other routing tables as well. OK claudio florian
-rw-r--r--sys/netinet6/raw_ip6.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 93daab77cec..f8ef94af2ea 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.137 2019/11/29 16:41:02 nayden Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.138 2020/08/02 11:15:51 kn Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -160,6 +160,10 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
TAILQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) {
if (in6p->inp_socket->so_state & SS_CANTRCVMORE)
continue;
+ if (rtable_l2(in6p->inp_rtableid) !=
+ rtable_l2(m->m_pkthdr.ph_rtableid))
+ continue;
+
if (!(in6p->inp_flags & INP_IPV6))
continue;
if ((in6p->inp_ipv6.ip6_nxt || proto == IPPROTO_ICMPV6) &&