summaryrefslogtreecommitdiffhomepage
path: root/src/router.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2015-09-07 11:39:19 +0200
committerSteven Barth <steven@midlink.org>2015-09-07 11:39:19 +0200
commit01c1163b979cb3872aba9274ecbf0b38f822f950 (patch)
treeacd37052f014a96284a8f5370c612bbe9a736882 /src/router.c
parent8458abaddf4b231df4e8f8aafdb0c38ae125da95 (diff)
router: reduce dns lifetime to 10x maximum interval
Diffstat (limited to 'src/router.c')
-rw-r--r--src/router.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/router.c b/src/router.c
index 9c9b55a..3fbf590 100644
--- a/src/router.c
+++ b/src/router.c
@@ -247,7 +247,6 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
struct odhcpd_ipaddr addrs[8];
ssize_t ipcnt = 0;
int64_t minvalid = INT64_MAX;
- int64_t maxvalid = 0;
// If not shutdown
if (iface->timer_rs.cb) {
@@ -293,9 +292,6 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
minvalid > 1000LL * TIME_LEFT(addr->valid, now))
minvalid = 1000LL * TIME_LEFT(addr->valid, now);
- if (maxvalid < 1000LL * TIME_LEFT(addr->valid, now))
- maxvalid = 1000LL * TIME_LEFT(addr->valid, now);
-
if (((addr->addr.s6_addr[0] & 0xfe) != 0xfc || iface->default_router)
&& ntohs(adv.h.nd_ra_router_lifetime) < TIME_LEFT(addr->valid, now))
adv.h.nd_ra_router_lifetime = htons(TIME_LEFT(addr->valid, now));
@@ -433,7 +429,7 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
minival = (maxival * 3) / 4;
- search->lifetime = htonl(maxvalid / 1000);
+ search->lifetime = maxival / 100;
dns.lifetime = search->lifetime;
odhcpd_urandom(&msecs, sizeof(msecs));