summaryrefslogtreecommitdiffhomepage
path: root/src/router.c
diff options
context:
space:
mode:
authorStijn Tintel <stijn@linux-ipv6.be>2016-08-14 20:22:57 +0300
committerStijn Tintel <stijn@linux-ipv6.be>2016-12-27 09:36:51 +0100
commit93ab25b2160ac8a2da6d5dc6ead003e9b8abf9c7 (patch)
tree8224a262a6f5cc7a560666b576d5c027db049040 /src/router.c
parente05553099c47b92420c21ff30b07709dfa40a84a (diff)
router: skip parse_routes when ra_default > 1
It does not make sense to scan the entire routing table if the decision will be overridden afterwards. This makes it possible to use odhcpd on a router with full IPv6 BGP table, by setting ra_default to 2. Without this change, odhcpd is constantly busy reading /proc/net/ipv6_route, and doesn't respond to router solicitations in time. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Diffstat (limited to 'src/router.c')
-rw-r--r--src/router.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/router.c b/src/router.c
index 9711975..f964a82 100644
--- a/src/router.c
+++ b/src/router.c
@@ -257,10 +257,10 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
memcpy(addrs, iface->ia_addr, ipcnt * sizeof(*addrs));
// Check default route
- if (parse_routes(addrs, ipcnt))
- adv.h.nd_ra_router_lifetime = htons(1);
if (iface->default_router > 1)
adv.h.nd_ra_router_lifetime = htons(iface->default_router);
+ else if (parse_routes(addrs, ipcnt))
+ adv.h.nd_ra_router_lifetime = htons(1);
}
// Construct Prefix Information options