summaryrefslogtreecommitdiffhomepage
path: root/src/netlink.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-11-26 14:58:08 +0100
committerHans Dedecker <dedeckeh@gmail.com>2018-11-27 09:50:41 +0100
commitd404c7e50bd487f9d8d3b13e5ff1c7fa878c7973 (patch)
tree399da5a85e9d9c69cda8c124661d7449a55eac92 /src/netlink.c
parentae6cf8008e50ba9838a056d78cb6aea405c55b7d (diff)
netlink: fix triggering of NETEV_ADDR6LIST_CHANGE event
Generate a NETEV_ADDR6LIST_CHANGE event in case the preferred lifetime makes a transition from deprecated (preferred lifetime not greater than current timestamp) to not deprecated (preferred lifetime greater than current timestamp) Reported-by: Tian Hao <haotia@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/netlink.c')
-rw-r--r--src/netlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/netlink.c b/src/netlink.c
index d238604..e502be0 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -160,6 +160,7 @@ static void refresh_iface_addr6(struct netevent_handler_info *event_info)
struct odhcpd_ipaddr *addr = NULL;
struct interface *iface = event_info->iface;
ssize_t len = netlink_get_interface_addrs(iface->ifindex, true, &addr);
+ time_t now = odhcpd_time();
if (len < 0)
return;
@@ -167,7 +168,7 @@ static void refresh_iface_addr6(struct netevent_handler_info *event_info)
bool change = len != (ssize_t)iface->addr6_len;
for (ssize_t i = 0; !change && i < len; ++i)
if (!IN6_ARE_ADDR_EQUAL(&addr[i].addr.in6, &iface->addr6[i].addr.in6) ||
- (addr[i].preferred > 0) != (iface->addr6[i].preferred > 0) ||
+ (addr[i].preferred > (uint32_t)now) != (iface->addr6[i].preferred > (uint32_t)now) ||
addr[i].valid < iface->addr6[i].valid ||
addr[i].preferred < iface->addr6[i].preferred)
change = true;