Skip to content

Commit

Permalink
Do not use SO_REUSEADDR with syslog socket.
Browse files Browse the repository at this point in the history
Some reg tests could fail because some syslog server were listening
to the same port. This is due to usage of SO_REUSEADDR socket option
which behave as SO_REUSEPORT.
  • Loading branch information
haproxyFred committed May 6, 2019
1 parent 049e5e3 commit 1787136
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/vtc_syslog.c
Expand Up @@ -151,7 +151,10 @@ VUDP_close(int *s)
static int
VUDP_bind(const struct suckaddr *sa, const char **errp)
{
int sd, val, e;
#ifdef IPV6_V6ONLY
int val;
#endif
int sd, e;
socklen_t sl;
const struct sockaddr *so;
int proto;
Expand All @@ -166,15 +169,6 @@ VUDP_bind(const struct suckaddr *sa, const char **errp)
*errp = "socket(2)";
return (-1);
}
val = 1;
if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof val) != 0) {
if (errp != NULL)
*errp = "setsockopt(SO_REUSEADDR, 1)";
e = errno;
closefd(&sd);
errno = e;
return (-1);
}

#ifdef IPV6_V6ONLY
/* forcibly use separate sockets for IPv4 and IPv6 */
Expand Down

0 comments on commit 1787136

Please sign in to comment.