From 5919273709902fe31aad2c4f540c6ac04ee5da7f Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 5 Mar 2018 15:45:34 +0000 Subject: [PATCH] - Fix #3582: Squelch address already in use log when reuseaddr option causes same port to be used twice for tcp connections. git-svn-id: file:///svn/unbound/trunk@4559 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 2 ++ util/netevent.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index 5df3701d1..238145088 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ 5 March 2018: Wouter - Fix to check define of DSA for when openssl is without deprecated. - iana port update. + - Fix #3582: Squelch address already in use log when reuseaddr option + causes same port to be used twice for tcp connections. 27 February 2018: Wouter - Fixup contrib/fastrpz.patch so that it applies. diff --git a/util/netevent.c b/util/netevent.c index 97e31dcbe..fc6f6a9ea 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -299,6 +299,12 @@ udp_send_errno_needs_log(struct sockaddr* addr, socklen_t addrlen) # endif ) && verbosity < VERB_DETAIL) return 0; +# ifdef EADDRINUSE + /* If SO_REUSEADDR is set, we could try to connect to the same server + * from the same source port twice. */ + if(errno == EADDRINUSE && verbosity < VERB_DETAIL) + return 0; +# endif /* squelch errors where people deploy AAAA ::ffff:bla for * authority servers, which we try for intranets. */ if(errno == EINVAL && addr_is_ip4mapped(