]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
isc_nm_listenudp: treat socket failures gracefully
authorMark Andrews <marka@isc.org>
Tue, 17 Jan 2023 06:25:25 +0000 (17:25 +1100)
committerMark Andrews <marka@isc.org>
Fri, 20 Jan 2023 00:05:24 +0000 (11:05 +1100)
The old code didn't handle race conditions and errors on systems
with non load balancing sockets gracefully.  Look for an error on
any child socket and if found close all the child sockets and return
an error.

lib/isc/netmgr/udp.c

index 9072d688b463f75a6b3eecad14e986cefdf35ad4..75adf446715702009fd78dfcb0151b2c1e638d4a 100644 (file)
@@ -177,8 +177,16 @@ isc_nm_listenudp(isc_nm_t *mgr, uint32_t workers, isc_sockaddr_t *iface,
                isc__nm_closesocket(fd);
        }
 
+       /*
+        * If any of the child sockets have failed then isc_nm_listenudp
+        * fails.
+        */
        for (size_t i = 1; i < sock->nchildren; i++) {
-               INSIST(result == sock->children[i].result);
+               if (result == ISC_R_SUCCESS &&
+                   sock->children[i].result != ISC_R_SUCCESS)
+               {
+                       result = sock->children[i].result;
+               }
        }
 
        atomic_store(&sock->active, true);