From: Juho Vähä-Herttua Date: Tue, 15 May 2012 19:39:00 +0000 (+0300) Subject: Attempt to make a temporary fix for Vista/Win7 X-Git-Tag: upstream/0.9.0~4^2~70 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e161255a2728cd2b8ee5f1768997eeb3b173e843;p=deb_shairplay.git Attempt to make a temporary fix for Vista/Win7 --- diff --git a/src/lib/netutils.c b/src/lib/netutils.c index 8226e4f..8c7c5f7 100644 --- a/src/lib/netutils.c +++ b/src/lib/netutils.c @@ -71,12 +71,20 @@ netutils_init_socket(unsigned short *port, int use_ipv6, int use_udp) memset(&saddr, 0, sizeof(saddr)); if (use_ipv6) { struct sockaddr_in6 *sin6ptr = (struct sockaddr_in6 *)&saddr; + int v6only = 0; /* Initialize sockaddr for bind */ sin6ptr->sin6_family = family; sin6ptr->sin6_addr = in6addr_any; sin6ptr->sin6_port = htons(*port); + /* Make sure we also listen to IPv4 addresses */ + ret = setsockopt(server_fd, IPPROTO_IPV6, IPV6_V6ONLY, + (char *) &v6only, sizeof(v6only)); + if (ret == -1) { + goto cleanup; + } + socklen = sizeof(*sin6ptr); ret = bind(server_fd, (struct sockaddr *)sin6ptr, socklen); if (ret == -1) {