Skip to content

Commit

Permalink
A patch for the FreeBSD ipv6 only issue from Tijl Coosemans <tijl@Fre…
Browse files Browse the repository at this point in the history
  • Loading branch information
ari committed Apr 26, 2016
1 parent 4cf4247 commit 10636a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions csync2.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static int csync_server_bind(void)
struct addrinfo hints;
struct addrinfo *result, *rp;
int save_errno;
int sfd = -1, s, on = 1;
int sfd = -1, s, off = 0, on = 1;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM;
Expand Down Expand Up @@ -289,7 +289,9 @@ static int csync_server_bind(void)
goto error;
if (setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, &on, (socklen_t) sizeof(on)) < 0)
goto error;

if (rp->ai_family == AF_INET6)
if (setsockopt(sfd, IPPROTO_IPV6, IPV6_V6ONLY, &off, (socklen_t) sizeof(off)) < 0)
goto error;
if (bind(sfd, rp->ai_addr, rp->ai_addrlen) == 0)
break; /* Success */

Expand Down

0 comments on commit 10636a4

Please sign in to comment.