diff options
author | 2015-07-17 20:38:33 +0000 | |
---|---|---|
committer | 2015-07-17 20:38:33 +0000 | |
commit | 4fb9461c8c2a2d3baf0310c7017c4fb5248a76d3 (patch) | |
tree | d5878879a2b829e56d068a8c139229ec91529b0b | |
parent | extenstion -> extension (diff) | |
download | wireguard-openbsd-4fb9461c8c2a2d3baf0310c7017c4fb5248a76d3.tar.xz wireguard-openbsd-4fb9461c8c2a2d3baf0310c7017c4fb5248a76d3.zip |
Like bgpd and ospfd filter routes by RTF_LLINFO and RTF_BROADCAST and use
the RTF_CONNECTED to know if a route is connected or not.
-rw-r--r-- | usr.sbin/ripd/kroute.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/ripd/kroute.c b/usr.sbin/ripd/kroute.c index 4c13ea087e6..f82126c5897 100644 --- a/usr.sbin/ripd/kroute.c +++ b/usr.sbin/ripd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.29 2015/02/11 05:58:08 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.30 2015/07/17 20:38:33 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -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 broadcast routes. */ + if (rtm->rtm_flags & (RTF_LLINFO|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,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; prio = rtm->rtm_priority; |