Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/if-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down