From: Fabian Keil Date: Mon, 18 Nov 2019 10:54:17 +0000 (+0100) Subject: Use the IP_FREEBIND socket option, if defined X-Git-Tag: v_3_0_29~567 X-Git-Url: http://www.privoxy.org/gitweb/user-manual/quickstart.html?a=commitdiff_plain;h=c4b124f7edbeab50338f8a311de0be1eb044a7cf;p=privoxy.git Use the IP_FREEBIND socket option, if defined This allows Privoxy to bind to not-yet assigned IP addresses which is useful in failover environments. Patch by Sam Varshavchik. --- diff --git a/jbsockets.c b/jbsockets.c index 625d830e..ab2228a7 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1068,6 +1068,10 @@ int bind_port(const char *hostnam, int portnum, int backlog, jb_socket *pfd) setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)); #endif /* ndef _WIN32 */ +#ifdef IP_FREEBIND + setsockopt(fd, IPPROTO_IP, IP_FREEBIND, (char *)&one, sizeof(one)); +#endif + #ifdef HAVE_RFC2553 if (bind(fd, rp->ai_addr, rp->ai_addrlen) < 0) #else