From: Frank Osterfeld Date: Wed, 21 Oct 2009 17:39:51 +0000 (+0300) Subject: Fix IPv6 setup (the default on Vista) X-Git-Tag: dbus-1.3.1~169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d27253f3660ebbb466f41cd2fa2f862999694b9;p=thirdparty%2Fdbus.git Fix IPv6 setup (the default on Vista) Ensure that the right struct is passed. Cherry-picked from commit 172d60d100d04e301e51ff475ada02007f1709dc in the dbus4win repository by tml@iki.fi. --- diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index b81e2ea43..f80bfd417 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -1516,6 +1516,16 @@ _dbus_listen_tcp_socket (const char *host, struct addrinfo hints; struct addrinfo *ai, *tmp; + // On Vista, sockaddr_gen must be a sockaddr_in6, and not a sockaddr_in6_old + //That's required for family == IPv6(which is the default on Vista if family is not given) + //So we use our own union instead of sockaddr_gen: + + typedef union { + struct sockaddr Address; + struct sockaddr_in AddressIn; + struct sockaddr_in6 AddressIn6; + } mysockaddr_gen; + *fds_p = NULL; _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -1608,7 +1618,7 @@ _dbus_listen_tcp_socket (const char *host, to use the same port */ if (!port || !strcmp(port, "0")) { - sockaddr_gen addr; + mysockaddr_gen addr; socklen_t addrlen = sizeof(addr); char portbuf[10];