]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix wrong errno value passed in route_socket()
authorOndřej Surý <ondrej@sury.org>
Fri, 6 Mar 2026 10:08:40 +0000 (11:08 +0100)
committerMartin Basti <mbasti@isc.org>
Thu, 13 Aug 2026 09:47:36 +0000 (11:47 +0200)
bind() returns -1 on failure and sets errno.  The code was passing the
return value `r` (which is always -1) to isc_errno_toresult() instead
of `errno`, causing incorrect error codes to be reported for netlink
bind failures.

lib/isc/netmgr/udp.c

index f0e21cb262d1bb9941ff69600ff4c8d3e1b313d7..6f544e0d7d117fba7259ad0d9558bffe2d643af1 100644 (file)
@@ -384,8 +384,9 @@ route_socket(uv_os_sock_t *fdp) {
        sa.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;
        r = bind(fd, (struct sockaddr *)&sa, sizeof(sa));
        if (r < 0) {
+               isc_result_t result = isc_errno_toresult(errno);
                isc__nm_closesocket(fd);
-               return isc_errno_toresult(r);
+               return result;
        }
 #endif