router: close socket upon NETEV_IFINDEX_CHANGE fixed
authorKoen Aerts <aertskoen5@gmail.com>
Mon, 19 Aug 2019 11:18:04 +0000 (13:18 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 19 Aug 2019 19:38:22 +0000 (21:38 +0200)
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 <aertskoen5@gmail.com>
src/router.c

index f1471db59959d0e48d7a0e6e628c5055b8633862..34d43b0af6bc95f51c5f8bbc4e198a0785c0a9d0 100644 (file)
@@ -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;
                }