So mpi@ fixed a problem with connected routes in bgpd. It is time to
update all the other kroute.c implementations as well.
ospfd, ospf6d, ripd, ldpd and snmpd (which I'm unsure about)
Please test
--
:wq Claudio
Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/kroute.c,v
retrieving revision 1.98
diff -u -p -r1.98 kroute.c
--- kroute.c 11 Feb 2015 05:57:44 -0000 1.98
+++ kroute.c 16 Jul 2015 23:19:24 -0000
@@ -1373,7 +1373,9 @@ rtmsg_process(char *buf, size_t len)
if ((sa = rti_info[RTAX_DST]) == NULL)
continue;
- if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */
+ /* Skip ARP/ND cache and local routes. */
+ if (rtm->rtm_flags &
+ (RTF_LLINFO|RTF_LOCAL|RTF_BROADCAST))
continue;
if (rtm->rtm_flags & RTF_MPATH)
@@ -1414,10 +1416,18 @@ rtmsg_process(char *buf, size_t len)
if ((sa = rti_info[RTAX_GATEWAY]) != NULL) {
switch (sa->sa_family) {
case AF_INET:
+ if (rtm->rtm_flags & RTF_CONNECTED) {
+ flags |= F_CONNECTED;
+ break;
+ }
+
nexthop.s_addr = ((struct
sockaddr_in *)sa)->sin_addr.s_addr;
break;
case AF_LINK:
+ /*
+ * Traditional BSD connected routes
have * a gateway of type AF_LINK.
+ */
flags |= F_CONNECTED;
break;
}
Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/kroute.c,v
retrieving revision 1.47
diff -u -p -r1.47 kroute.c
--- kroute.c 11 Feb 2015 05:58:57 -0000 1.47
+++ kroute.c 16 Jul 2015 23:17:27 -0000
@@ -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 local routes. */
+ if (rtm->rtm_flags & (RTF_LLINFO|RTF_LOCAL|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,9 @@ dispatch_rtmsg(void)
if (rtm->rtm_errno) /* failed attempts... */
continue;
- if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */
+ /* Skip ARP/ND cache and local routes. */
+ if (rtm->rtm_flags &
+ (RTF_LLINFO|RTF_LOCAL|RTF_BROADCAST))
continue;
#ifdef RTF_MPATH
Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ripd/kroute.c,v
retrieving revision 1.29
diff -u -p -r1.29 kroute.c
--- kroute.c 11 Feb 2015 05:58:08 -0000 1.29
+++ kroute.c 16 Jul 2015 23:18:22 -0000
@@ -849,7 +849,8 @@ fetchtable(void)
if ((sa = rti_info[RTAX_DST]) == NULL)
continue;
- if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */
+ /* Skip ARP/ND cache and local routes. */
+ if (rtm->rtm_flags & (RTF_LLINFO|RTF_LOCAL|RTF_BROADCAST))
continue;
#ifdef RTF_MPATH
@@ -907,10 +908,19 @@ fetchtable(void)
if ((sa = rti_info[RTAX_GATEWAY]) != NULL)
switch (sa->sa_family) {
case AF_INET:
+ if (rtm->rtm_flags & RTF_CONNECTED) {
+ kr->r.flags |= F_CONNECTED;
+ break;
+ }
+
kr->r.nexthop.s_addr =
((struct sockaddr_in *)sa)->sin_addr.s_addr;
break;
case AF_LINK:
+ /*
+ * Traditional BSD connected routes have
+ * a gateway of type AF_LINK.
+ */
kr->r.flags |= F_CONNECTED;
break;
}
@@ -1065,7 +1075,9 @@ dispatch_rtmsg(void)
if (rtm->rtm_errno) /* failed
attempts... */
continue;
- if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */
+ /* Skip ARP/ND cache and local routes. */
+ if (rtm->rtm_flags &
+ (RTF_LLINFO|RTF_LOCAL|RTF_BROADCAST))
continue;
prio = rtm->rtm_priority;
Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldpd/kroute.c,v
retrieving revision 1.41
diff -u -p -r1.41 kroute.c
--- kroute.c 4 Apr 2015 16:21:48 -0000 1.41
+++ kroute.c 16 Jul 2015 21:57:33 -0000
@@ -1215,7 +1215,9 @@ rtmsg_process(char *buf, size_t len)
if ((sa = rti_info[RTAX_DST]) == NULL)
continue;
- if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */
+ /* Skip ARP/ND cache and local routes. */
+ if (rtm->rtm_flags &
+ (RTF_LLINFO|RTF_LOCAL|RTF_BROADCAST))
continue;
/* LDP should follow the IGP and ignore BGP routes */
@@ -1258,10 +1260,18 @@ rtmsg_process(char *buf, size_t len)
if ((sa = rti_info[RTAX_GATEWAY]) != NULL) {
switch (sa->sa_family) {
case AF_INET:
+ if (rtm->rtm_flags & RTF_CONNECTED) {
+ flags |= F_CONNECTED;
+ break;
+ }
nexthop.s_addr = ((struct
sockaddr_in *)sa)->sin_addr.s_addr;
break;
case AF_LINK:
+ /*
+ * Traditional BSD connected routes have
+ * a gateway of type AF_LINK.
+ */
flags |= F_CONNECTED;
break;
}
Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/snmpd/kroute.c,v
retrieving revision 1.30
diff -u -p -r1.30 kroute.c
--- kroute.c 16 Jan 2015 00:05:13 -0000 1.30
+++ kroute.c 16 Jul 2015 22:10:18 -0000
@@ -1458,7 +1458,19 @@ dispatch_rtmsg_addr(struct ktable *kt, s
if ((sa = rti_info[RTAX_GATEWAY]) != NULL)
switch (sa->sa_family) {
+ case AF_INET:
+ case AF_INET6:
+ if (rtm->rtm_flags & RTF_CONNECTED) {
+ flags |= F_CONNECTED;
+ ifindex = rtm->rtm_index;
+ }
+ mpath = 0; /* link local stuff can't be mpath */
+ break;
case AF_LINK:
+ /*
+ * Traditional BSD connected routes have
+ * a gateway of type AF_LINK.
+ */
flags |= F_CONNECTED;
ifindex = rtm->rtm_index;
mpath = 0; /* link local stuff can't be mpath */