]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP6: Delete the eloop event before closing an ia listener socket
authorRoy Marples <roy@marples.name>
Thu, 21 May 2026 07:43:58 +0000 (08:43 +0100)
committerRoy Marples <roy@marples.name>
Thu, 21 May 2026 17:31:09 +0000 (18:31 +0100)
This only happens when dhcpcd is running on a specific interface
and can trigger erroneous logs deleting the socket from
kqueue/epoll.
With the prior eloop it could also trigger ia events from a
non related fd if re-used.

Hopefully fixes #596.

src/ipv6.c

index af5fd2773c28547d190bff5d828c8c1897e715d8..263fb6a08905b511114776d8ac84c76d4b7de988 100644 (file)
@@ -1023,8 +1023,8 @@ ipv6_freeaddr(struct ipv6_addr *ia)
 #endif
 
        if (ia->dhcp6_fd != -1) {
-               close(ia->dhcp6_fd);
                eloop_event_delete(eloop, ia->dhcp6_fd);
+               close(ia->dhcp6_fd);
        }
 
        eloop_q_timeout_delete(eloop, ELOOP_QUEUE_ALL, NULL, ia);