Set SO_REUSEADDR in regression test netcat.

Sometimes multiplex tests fail on Solaris with "netcat: local_listen:
Address already in use" which is likely due to previous invocations
leaving the port in TIME_WAIT.  Set SO_REUSEADDR (in addition to
SO_REUSEPORT which is alread set on platforms that support it).  ok djm@
This commit is contained in:
Darren Tucker 2018-02-08 12:36:22 +11:00
parent 1749991c55
commit aee49b2a89
1 changed files with 6 additions and 1 deletions

View File

@ -738,7 +738,12 @@ local_listen(char *host, char *port, struct addrinfo hints)
#ifdef SO_REUSEPORT #ifdef SO_REUSEPORT
ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
if (ret == -1) if (ret == -1)
err(1, "setsockopt"); err(1, "setsockopt SO_REUSEPORT");
#endif
#ifdef SO_REUSEADDR
ret = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
if (ret == -1)
err(1, "setsockopt SO_REUSEADDR");
#endif #endif
set_common_sockopts(s); set_common_sockopts(s);