From: Mark Andrews Date: Tue, 17 Jan 2023 06:47:32 +0000 (+1100) Subject: isc_nm_listentcp: treat socket failures gracefully X-Git-Tag: v9.19.10~25^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08c39736a968d9906d88ea69e3c6a75df1dedf88;p=thirdparty%2Fbind9.git isc_nm_listentcp: treat socket failures gracefully 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. --- diff --git a/lib/isc/netmgr/tcp.c b/lib/isc/netmgr/tcp.c index d0ce958278f..ab2651522af 100644 --- a/lib/isc/netmgr/tcp.c +++ b/lib/isc/netmgr/tcp.c @@ -431,8 +431,16 @@ isc_nm_listentcp(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_listentcp + * 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);