diff --git a/ChangeLog b/ChangeLog index f02f5be..d9704aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ Version 1.8.0 ******************************************************************************* +2010-09-10 Chandra Penke + Add support for conditionally enabling ipv6. + 2010-08-22 Marcelo Jimenez * upnp/src/api/Discovery.c: Fix a serious bug and memory leak in UpnpDiscovery_strcpy_DeviceType(). Thanks to David Blanchet for the diff --git a/upnp/src/genlib/miniserver/miniserver.c b/upnp/src/genlib/miniserver/miniserver.c index 80ad18b..9d6e04f 100644 --- a/upnp/src/genlib/miniserver/miniserver.c +++ b/upnp/src/genlib/miniserver/miniserver.c @@ -579,22 +579,21 @@ static int get_miniserver_sockets( { char errorBuffer[ERROR_BUFFER_LEN]; struct sockaddr_storage __ss_v4; - struct sockaddr_storage __ss_v6; struct sockaddr_in* serverAddr4 = (struct sockaddr_in*)&__ss_v4; -#ifdef UPNP_ENABLE_IPV6 - struct sockaddr_in6* serverAddr6 = (struct sockaddr_in6*)&__ss_v6; -#endif SOCKET listenfd4 = INVALID_SOCKET; + unsigned short actual_port4; #ifdef UPNP_ENABLE_IPV6 + struct sockaddr_storage __ss_v6; + struct sockaddr_in6* serverAddr6 = (struct sockaddr_in6*)&__ss_v6; SOCKET listenfd6 = INVALID_SOCKET; + unsigned short actual_port6; #endif int ret_code; - unsigned short actual_port4, actual_port6; int reuseaddr_on = 0; int sockError = UPNP_E_SUCCESS; int errCode = 0; - // + // // Initialize all the sockets to be invalid // out->miniServerSock4 = INVALID_SOCKET; @@ -678,8 +677,7 @@ static int get_miniserver_sockets( } #ifdef UPNP_ENABLE_IPV6 - if(listenfd6 != INVALID_SOCKET) - { + if (listenfd6 != INVALID_SOCKET) { sockError = setsockopt(listenfd6, SOL_SOCKET, SO_REUSEADDR, (const char *)&reuseaddr_on, sizeof (int)); if (sockError == -1) { @@ -706,8 +704,7 @@ static int get_miniserver_sockets( } } #endif //IPv6 - } else - { + } else { if (listenfd4 != INVALID_SOCKET) { unsigned short orig_listen_port4 = listen_port4; do {