From: patthoyts Date: Tue, 24 Feb 2004 16:23:41 +0000 (+0000) Subject: Some IPv6 fixes for WinXP X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fdev-2;p=tcludp Some IPv6 fixes for WinXP --- diff --git a/generic/udp_tcl.c b/generic/udp_tcl.c index c7cb0b1..a54a268 100644 --- a/generic/udp_tcl.c +++ b/generic/udp_tcl.c @@ -403,9 +403,10 @@ UdpGetAddressFromObj( } #else #error "No IPv6 address conversion function." -#endif addr->sin6_family = AF_INET6; addr->sin6_port = port; +#endif + #endif /* SIPC_IPV6 */ } else { @@ -469,7 +470,7 @@ UdpGetObjFromAddress( parts[1] = Tcl_NewIntObj(addr->sin6_port); #else Tcl_SetObjResult(interp, - Tcl_NewStringObj("error: ipv6 not supported in this build")); + Tcl_NewStringObj("error: ipv6 not supported in this build", -1)); return TCL_ERROR; #endif } else { @@ -550,7 +551,7 @@ Tcl_MakeUdpChannel(SOCKET sock) statePtr->sock = sock; getsockname(sock, (struct sockaddr *)&name, &len); - if (name.ss_family == AF_INET) { + if (((struct sockaddr *)&name)->sa_family == AF_INET) { ((struct sockaddr_in *)&statePtr->saddr_local)->sin_addr.s_addr = INADDR_NONE; ((struct sockaddr_in *)&statePtr->saddr_remote)->sin_addr.s_addr diff --git a/generic/udp_tcl.h b/generic/udp_tcl.h index 8bb8691..bd3deb7 100644 --- a/generic/udp_tcl.h +++ b/generic/udp_tcl.h @@ -23,7 +23,11 @@ #endif #if defined(_WIN32) && !defined(WIN32) -#define WIN32 +# define WIN32 +# if WINVER > 0x0500 +# define SIPC_IPV6 1 +# define HAVE_GETADDRINFO 1 +# endif #endif #ifdef WIN32