summaryrefslogtreecommitdiffstats
path: root/src/ipv6nd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-06-14 17:05:24 +0100
committerRoy Marples <roy@marples.name>2019-06-14 17:05:24 +0100
commit6da1356363264bcfb6237797965ef59c234fa795 (patch)
tree7fbe6a87728a2a9f42de5a7dc93cc0e37a81d02f /src/ipv6nd.c
parent44f9b62cfa3914d5acdee68c3fb9ca3e6168847e (diff)
downloaddhcpcd-6da1356363264bcfb6237797965ef59c234fa795.tar.xz
RA: expire whole RA on carrier up
If preserving IP, we need to expire the whole RA now that we care about RDNSS and DNSSL lifetimes. Cheat by setting the aquired time to something very low so it all expires.
Diffstat (limited to 'src/ipv6nd.c')
-rw-r--r--src/ipv6nd.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/src/ipv6nd.c b/src/ipv6nd.c
index 1adb5e16..5ece711e 100644
--- a/src/ipv6nd.c
+++ b/src/ipv6nd.c
@@ -526,46 +526,34 @@ ipv6nd_advertise(struct ipv6_addr *ia)
ipv6nd_sendadvertisement(iaf);
}
-void
-ipv6nd_expire(struct interface *ifp, uint32_t seconds)
+static void
+ipv6nd_expire(void *arg)
{
+ struct interface *ifp = arg;
struct ra *rap;
- struct timespec now;
- uint32_t vltime = seconds;
- uint32_t pltime = seconds / 2;
+ struct ipv6_addr *ia;
+ struct timespec now = { .tv_sec = 1 };
if (ifp->ctx->ra_routers == NULL)
return;
- clock_gettime(CLOCK_MONOTONIC, &now);
-
TAILQ_FOREACH(rap, ifp->ctx->ra_routers, next) {
- if (rap->iface == ifp) {
- rap->acquired = now;
- rap->expired = seconds ? 0 : 1;
- if (seconds) {
- struct ipv6_addr *ia;
-
- rap->lifetime = seconds;
- TAILQ_FOREACH(ia, &rap->addrs, next) {
- if (ia->prefix_pltime > pltime ||
- ia->prefix_vltime > vltime)
- {
- ia->acquired = now;
- if (ia->prefix_pltime != 0)
- ia->prefix_pltime =
- pltime;
- ia->prefix_vltime = vltime;
- }
- }
- ipv6_addaddrs(&rap->addrs);
- }
+ if (rap->iface == ifp)
+ continue;
+ rap->acquired = now;
+ TAILQ_FOREACH(ia, &rap->addrs, next) {
+ ia->acquired = now;
}
}
- if (seconds)
- ipv6nd_expirera(ifp);
- else
- rt_build(ifp->ctx, AF_INET6);
+ ipv6nd_expirera(ifp);
+}
+
+void
+ipv6nd_startexpire(struct interface *ifp)
+{
+
+ eloop_timeout_add_sec(ifp->ctx->eloop, RTR_CARRIER_EXPIRE,
+ ipv6nd_expire, ifp);
}
static void