From c4b124f7edbeab50338f8a311de0be1eb044a7cf Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Mon, 18 Nov 2019 11:54:17 +0100 Subject: [PATCH] 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. --- jbsockets.c | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 2.39.2