summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospf6d/kroute.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-07-17 20:12:38 +0000
committerclaudio <claudio@openbsd.org>2015-07-17 20:12:38 +0000
commit4783dd8f8dc56333f4e31bc952cafb0032b198dc (patch)
treedce78f6a8c4190559a0395c4961fc564a9a23756 /usr.sbin/ospf6d/kroute.c
parentDo similar handling of connected routes and filtering of llinfo and broadcast. (diff)
downloadwireguard-openbsd-4783dd8f8dc56333f4e31bc952cafb0032b198dc.tar.xz
wireguard-openbsd-4783dd8f8dc56333f4e31bc952cafb0032b198dc.zip
Similar to bgpd and ospfd skip broadcast (should not happen) and llinfo
routes also adjust the tracking of connected routes to the new way.
Diffstat (limited to 'usr.sbin/ospf6d/kroute.c')
-rw-r--r--usr.sbin/ospf6d/kroute.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c
index 84c06edb206..fcb5cae5bfc 100644
--- a/usr.sbin/ospf6d/kroute.c
+++ b/usr.sbin/ospf6d/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.47 2015/02/11 05:58:57 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.48 2015/07/17 20:12:38 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -1092,7 +1092,8 @@ fetchtable(void)
if ((sa = rti_info[RTAX_DST]) == NULL)
continue;
- if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */
+ /* Skip ARP/ND cache and broadcast routes. */
+ if (rtm->rtm_flags & (RTF_LLINFO|RTF_BROADCAST))
continue;
if ((kr = calloc(1, sizeof(struct kroute_node))) == NULL) {
@@ -1137,6 +1138,11 @@ fetchtable(void)
if ((sa = rti_info[RTAX_GATEWAY]) != NULL)
switch (sa->sa_family) {
case AF_INET6:
+ if (rtm->rtm_flags & RTF_CONNECTED) {
+ kr->r.flags |= F_CONNECTED;
+ break;
+ }
+
sa_in6 = (struct sockaddr_in6 *)sa;
/*
* XXX The kernel provides the scope via the
@@ -1147,6 +1153,10 @@ fetchtable(void)
kr->r.scope = sa_in6->sin6_scope_id;
break;
case AF_LINK:
+ /*
+ * Traditional BSD connected routes have
+ * a gateway of type AF_LINK.
+ */
kr->r.flags |= F_CONNECTED;
break;
}
@@ -1298,7 +1308,8 @@ dispatch_rtmsg(void)
if (rtm->rtm_errno) /* failed attempts... */
continue;
- if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */
+ /* Skip ARP/ND cache and broadcast routes. */
+ if (rtm->rtm_flags & (RTF_LLINFO|RTF_BROADCAST))
continue;
#ifdef RTF_MPATH