]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix to squelch tcp socket bind failures when the interface is gone.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 4 May 2021 14:21:42 +0000 (16:21 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 4 May 2021 14:21:42 +0000 (16:21 +0200)
doc/Changelog
services/outside_network.c

index 6edbcf9692eae5835354a7da8aea2ca404752fa3..ca25ccc4cd4a81b06d471f640235f12b81b23003 100644 (file)
@@ -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.
index a1c18c6171847106f96fce38097b7b12b219b9d3..9b09aa3609560929a09707ec498c517df5203484 100644 (file)
@@ -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;
        }