From 09aa022ea1990dbb3f3f0d09331ef0cd1b8a8e1a Mon Sep 17 00:00:00 2001 From: Koen Aerts Date: Mon, 19 Aug 2019 13:18:04 +0200 Subject: [PATCH] router: close socket upon NETEV_IFINDEX_CHANGE fixed Make sure the raw socket is removed from the uloop file descriptor list before the socket is closed as introduced in https://github.com/openwrt/odhcpd/commit/000182fe4f94a5a6ec139456a2b74f0cdea13b9c Related to https://github.com/openwrt/odhcpd/issues/135 Signed-off-by: Koen Aerts --- src/router.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/router.c b/src/router.c index f1471db..34d43b0 100644 --- a/src/router.c +++ b/src/router.c @@ -232,6 +232,9 @@ static void router_netevent_cb(unsigned long event, struct netevent_handler_info case NETEV_IFINDEX_CHANGE: iface = info->iface; if (iface && iface->router_event.uloop.fd >= 0) { + if (iface->router_event.uloop.registered) + uloop_fd_delete(&iface->router_event.uloop); + close(iface->router_event.uloop.fd); iface->router_event.uloop.fd = -1; } -- 2.30.2