summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-07-13 08:40:46 +0000
committermpi <mpi@openbsd.org>2016-07-13 08:40:46 +0000
commitb71b7f0a6b7f463d1d08ae748637c9ea828825dc (patch)
treebbb908ee04f2d3c0bdbf6e71943e2cf569323dc8 /sys
parentCPUID vendor ID was already register-swapped during initial query, so no (diff)
downloadwireguard-openbsd-b71b7f0a6b7f463d1d08ae748637c9ea828825dc.tar.xz
wireguard-openbsd-b71b7f0a6b7f463d1d08ae748637c9ea828825dc.zip
Introduce RTF_MULTICAST and flag corresponding IPv6 routes as such
instead of abusing RTF_CLONING. Fix a leak reporeted by Aaron Riekenberg on misc@, ok sthen@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/route.h4
-rw-r--r--sys/netinet/if_ether.c4
-rw-r--r--sys/netinet6/in6.c7
-rw-r--r--sys/netinet6/nd6.c4
4 files changed, 9 insertions, 10 deletions
diff --git a/sys/net/route.h b/sys/net/route.h
index 7e567cd918e..0e3eaf56107 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.140 2016/07/11 13:06:31 bluhm Exp $ */
+/* $OpenBSD: route.h,v 1.141 2016/07/13 08:40:46 mpi Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -130,7 +130,7 @@ struct rtentry {
#define RTF_DONE 0x40 /* message confirmed */
#define RTF_MASK 0x80 /* subnet mask present */
#define RTF_CLONING 0x100 /* generate new routes on use */
-/* 0x200 unused */
+#define RTF_MULTICAST 0x200 /* route associated to a mcast addr. */
#define RTF_LLINFO 0x400 /* generated by ARP or ND */
#define RTF_STATIC 0x800 /* manually added */
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index e612402325d..da733631a42 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.217 2016/07/11 09:23:06 mpi Exp $ */
+/* $OpenBSD: if_ether.c,v 1.218 2016/07/13 08:40:46 mpi Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -139,7 +139,7 @@ arp_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
timeout_add_sec(&arptimer_to, 1);
}
- if (rt->rt_flags & (RTF_GATEWAY|RTF_BROADCAST))
+ if (ISSET(rt->rt_flags, RTF_GATEWAY|RTF_BROADCAST|RTF_MULTICAST))
return;
switch (req) {
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 0de02a67d8d..bd0b3155629 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.188 2016/07/05 10:17:14 mpi Exp $ */
+/* $OpenBSD: in6.c,v 1.189 2016/07/13 08:40:46 mpi Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -757,8 +757,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr);
info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask);
info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr);
- /* XXX: we need RTF_CLONING to fake nd6_rtrequest */
- info.rti_flags = RTF_CLONING;
+ info.rti_flags = RTF_MULTICAST;
error = rtrequest(RTM_ADD, &info, RTP_CONNECTED, NULL,
ifp->if_rdomain);
if (error)
@@ -814,7 +813,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr);
info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask);
info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr);
- info.rti_flags = RTF_CLONING;
+ info.rti_flags = RTF_MULTICAST;
error = rtrequest(RTM_ADD, &info, RTP_CONNECTED, NULL,
ifp->if_rdomain);
if (error)
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index d7d7480dfbb..b523d4a08c8 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.187 2016/07/13 01:51:22 dlg Exp $ */
+/* $OpenBSD: nd6.c,v 1.188 2016/07/13 08:40:46 mpi Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -882,7 +882,7 @@ nd6_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
dr->installed = 0;
}
- if ((rt->rt_flags & RTF_GATEWAY) != 0)
+ if (ISSET(rt->rt_flags, RTF_GATEWAY|RTF_MULTICAST))
return;
if (nd6_need_cache(ifp) == 0 && (rt->rt_flags & RTF_HOST) == 0) {