From: W.C.A. Wijngaards Date: Tue, 4 May 2021 14:21:42 +0000 (+0200) Subject: - Fix to squelch tcp socket bind failures when the interface is gone. X-Git-Tag: release-1.13.2rc1~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90d0f8bc19695250a1fcb2235f6a3b4e25098444;p=thirdparty%2Funbound.git - Fix to squelch tcp socket bind failures when the interface is gone. --- diff --git a/doc/Changelog b/doc/Changelog index 6edbcf969..ca25ccc4c 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,7 @@ 4 May 2021: Wouter - Merge #478: Allow configuration of TCP timeout while waiting for response. + - Fix to squelch tcp socket bind failures when the interface is gone. 3 May 2021: Wouter - Fix #481: Fix comment in configuration file. diff --git a/services/outside_network.c b/services/outside_network.c index a1c18c617..9b09aa360 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -238,7 +238,14 @@ pick_outgoing_tcp(struct pending_tcp* pend, struct waiting_tcp* w, int s) ((struct sockaddr_in6*)&pi->addr)->sin6_port = 0; else ((struct sockaddr_in*)&pi->addr)->sin_port = 0; if(bind(s, (struct sockaddr*)&pi->addr, pi->addrlen) != 0) { - log_err("outgoing tcp: bind: %s", sock_strerror(errno)); +#ifndef USE_WINSOCK +#ifdef EADDRNOTAVAIL + if(!(verbosity < 4 && errno == EADDRNOTAVAIL)) +#endif +#else /* USE_WINSOCK */ + if(!(verbosity < 4 && WSAGetLastError() == WSAEADDRNOTAVAIL)) +#endif + log_err("outgoing tcp: bind: %s", sock_strerror(errno)); sock_close(s); return 0; }