From d404c7e50bd487f9d8d3b13e5ff1c7fa878c7973 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Mon, 26 Nov 2018 14:58:08 +0100 Subject: [PATCH] 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 Signed-off-by: Hans Dedecker --- src/netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.30.2