diff --git a/src/if-linux.c b/src/if-linux.c index d7b8330b..97a0a319 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -1783,7 +1783,8 @@ if_route(unsigned char cmd, const struct rt *rt) if (rt->rt_lifetime != 0) { uint32_t expires; - expires = lifetime_left(rt->rt_lifetime, &rt->rt_aquired, NULL); + expires = lifetime_left(rt->rt_lifetime, &rt->rt_acquired, + NULL); add_attr_32(&nlm.hdr, sizeof(nlm), RTA_EXPIRES, expires); } #endif diff --git a/src/ipv6.c b/src/ipv6.c index 20caa5e6..c8469a22 100644 --- a/src/ipv6.c +++ b/src/ipv6.c @@ -2308,7 +2308,7 @@ inet6_raroutes(rb_tree_t *routes, struct dhcpcd_ctx *ctx) rt->rt_pref = ipv6nd_rtpref(rinfo->flags); #endif #ifdef HAVE_ROUTE_LIFETIME - rt->rt_aquired = rinfo->acquired; + rt->rt_acquired = rinfo->acquired; rt->rt_lifetime = rinfo->lifetime, #endif rt_proto_add(routes, rt); @@ -2325,7 +2325,7 @@ inet6_raroutes(rb_tree_t *routes, struct dhcpcd_ctx *ctx) rt->rt_pref = ipv6nd_rtpref(rap->flags); #endif #ifdef HAVE_ROUTE_LIFETIME - rt->rt_aquired = addr->acquired; + rt->rt_acquired = addr->acquired; rt->rt_lifetime = addr->prefix_vltime; #endif @@ -2361,7 +2361,7 @@ inet6_raroutes(rb_tree_t *routes, struct dhcpcd_ctx *ctx) rt->rt_pref = ipv6nd_rtpref(rap->flags); #endif #ifdef HAVE_ROUTE_LIFETIME - rt->rt_aquired = rap->acquired; + rt->rt_acquired = rap->acquired; rt->rt_lifetime = rap->lifetime; #endif @@ -2400,7 +2400,7 @@ inet6_dhcproutes(rb_tree_t *routes, struct dhcpcd_ctx *ctx, enum DH6S dstate) continue; rt->rt_dflags |= RTDF_DHCP; #ifdef HAVE_ROUTE_LIFETIME - rt->rt_aquired = ia->acquired; + rt->rt_acquired = ia->acquired; rt->rt_lifetime = ia->prefix_vltime; #endif rt_proto_add(routes, rt); diff --git a/src/route.c b/src/route.c index 20d82d79..bd98159e 100644 --- a/src/route.c +++ b/src/route.c @@ -558,7 +558,7 @@ rt_cmp_lifetime(struct rt *nrt, struct rt *ort) struct timespec ts; uint32_t deviation; - timespecsub(&nrt->rt_aquired, &ort->rt_aquired, &ts); + timespecsub(&nrt->rt_acquired, &ort->rt_acquired, &ts); if (ts.tv_sec < 0) ts.tv_sec = -ts.tv_sec; if (ts.tv_sec > RTLIFETIME_DEV_MAX) @@ -753,7 +753,12 @@ rt_doroute(rb_tree_t *kroutes, struct rt *rt) rt_cmp_mtu(rt, or) != 0) { if (!rt_add(kroutes, rt, or)) return false; + } else { +#ifdef HAVE_ROUTE_LIFETIME + rt->rt_acquired = or->rt_acquired; +#endif } + rb_tree_remove_node(&ctx->routes, or); rt_free(or); } else { diff --git a/src/route.h b/src/route.h index e43d1e69..063c2ede 100644 --- a/src/route.h +++ b/src/route.h @@ -139,9 +139,9 @@ struct rt { rb_node_t rt_tree; #ifdef HAVE_ROUTE_LIFETIME - struct timespec rt_aquired; /* timestamp of aquisition */ - uint32_t rt_lifetime; /* current lifetime of route */ -#define RTLIFETIME_DEV_MAX 2 /* max deviation for cmp */ + struct timespec rt_acquired; /* timestamp of acquisition */ + uint32_t rt_lifetime; /* current lifetime of route */ +#define RTLIFETIME_DEV_MAX 2 /* max deviation for cmp */ #endif };