dot not try to find IPv6 address if IPv6 is disabled

see #49
This commit is contained in:
Thomas Bernard 2016-12-16 09:39:19 +01:00
parent 2a1cc8d798
commit 32855b854c
1 changed files with 12 additions and 9 deletions

View File

@ -322,6 +322,7 @@ OpenAndConfHTTPSocket(unsigned short * port)
syslog(LOG_WARNING, "socket(PF_INET6, ...) failed with EAFNOSUPPORT, disabling IPv6"); syslog(LOG_WARNING, "socket(PF_INET6, ...) failed with EAFNOSUPPORT, disabling IPv6");
SETFLAG(IPV6DISABLEDMASK); SETFLAG(IPV6DISABLEDMASK);
ipv6 = 0; ipv6 = 0;
/* Try again with IPv4 */
s = socket(PF_INET, SOCK_STREAM, 0); s = socket(PF_INET, SOCK_STREAM, 0);
} }
#endif #endif
@ -1927,16 +1928,18 @@ main(int argc, char * * argv)
#endif /* V6SOCKETS_ARE_V6ONLY */ #endif /* V6SOCKETS_ARE_V6ONLY */
#endif /* ENABLE_HTTPS */ #endif /* ENABLE_HTTPS */
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
if(find_ipv6_addr(lan_addrs.lh_first ? lan_addrs.lh_first->ifname : NULL, if(!GETFLAG(IPV6DISABLEDMASK)) {
ipv6_addr_for_http_with_brackets, sizeof(ipv6_addr_for_http_with_brackets)) > 0) { if(find_ipv6_addr(lan_addrs.lh_first ? lan_addrs.lh_first->ifname : NULL,
syslog(LOG_NOTICE, "HTTP IPv6 address given to control points : %s", ipv6_addr_for_http_with_brackets, sizeof(ipv6_addr_for_http_with_brackets)) > 0) {
ipv6_addr_for_http_with_brackets); syslog(LOG_NOTICE, "HTTP IPv6 address given to control points : %s",
} else { ipv6_addr_for_http_with_brackets);
memcpy(ipv6_addr_for_http_with_brackets, "[::1]", 6); } else {
syslog(LOG_WARNING, "no HTTP IPv6 address, disabling IPv6"); memcpy(ipv6_addr_for_http_with_brackets, "[::1]", 6);
SETFLAG(IPV6DISABLEDMASK); syslog(LOG_WARNING, "no HTTP IPv6 address, disabling IPv6");
SETFLAG(IPV6DISABLEDMASK);
}
} }
#endif #endif /* ENABLE_IPV6 */
/* open socket for SSDP connections */ /* open socket for SSDP connections */
sudp = OpenAndConfSSDPReceiveSocket(0); sudp = OpenAndConfSSDPReceiveSocket(0);