Use SO_REUSEADDR on the socket, to make the use of syslogd in jails easier.
Submitted by: Jeremie Le Hen <jeremie le-hen org>
This commit is contained in:
parent
466cbb4b88
commit
20c0b2d3c3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150689
@ -2553,13 +2553,13 @@ socksetup(int af, const char *bindhostname)
|
||||
*socks = 0; /* num of sockets counter at start of array */
|
||||
s = socks + 1;
|
||||
for (r = res; r; r = r->ai_next) {
|
||||
int on = 1;
|
||||
*s = socket(r->ai_family, r->ai_socktype, r->ai_protocol);
|
||||
if (*s < 0) {
|
||||
logerror("socket");
|
||||
continue;
|
||||
}
|
||||
if (r->ai_family == AF_INET6) {
|
||||
int on = 1;
|
||||
if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
(char *)&on, sizeof (on)) < 0) {
|
||||
logerror("setsockopt");
|
||||
@ -2567,6 +2567,12 @@ socksetup(int af, const char *bindhostname)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&on, sizeof (on)) < 1) {
|
||||
logerror("setsockopt");
|
||||
close(*s);
|
||||
continue;
|
||||
}
|
||||
if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) {
|
||||
close(*s);
|
||||
logerror("bind");
|
||||
|
Loading…
Reference in New Issue
Block a user