aboutsummaryrefslogtreecommitdiff
path: root/X11/xtrans/Xtranssock.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-10-18 13:41:37 +0000
committermarha <marha@users.sourceforge.net>2009-10-18 13:41:37 +0000
commit814b98c7e9cde9c8e97b476e6d409bc2607d846c (patch)
tree1a191c9f7bafa0d184aefca0a5b995ad4c4e1fd9 /X11/xtrans/Xtranssock.c
parent27bc6d5e30150409259aa9030e668e801eb0b5a6 (diff)
parentb567a3027bceabc0f1f42dd162268f06f15e8149 (diff)
downloadvcxsrv-814b98c7e9cde9c8e97b476e6d409bc2607d846c.tar.gz
vcxsrv-814b98c7e9cde9c8e97b476e6d409bc2607d846c.tar.bz2
vcxsrv-814b98c7e9cde9c8e97b476e6d409bc2607d846c.zip
svn merge ^/branches/released
Diffstat (limited to 'X11/xtrans/Xtranssock.c')
-rw-r--r--X11/xtrans/Xtranssock.c78
1 files changed, 20 insertions, 58 deletions
diff --git a/X11/xtrans/Xtranssock.c b/X11/xtrans/Xtranssock.c
index 128bd4a94..4c39c4064 100644
--- a/X11/xtrans/Xtranssock.c
+++ b/X11/xtrans/Xtranssock.c
@@ -233,19 +233,6 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
#endif
/*
- * This provides compatibility for apps linked against system libraries
- * that don't have IPv6 support.
- */
-#if defined(IPv6) && defined(AF_INET6)
-static const struct in6_addr local_in6addr_any = IN6ADDR_ANY_INIT;
-#pragma weak in6addr_any = local_in6addr_any
-#ifndef __USLC__
-#pragma weak getaddrinfo
-#endif
-static int haveIPv6 = 1;
-#endif
-
-/*
* These are some utility function used by the real interface function below.
*/
@@ -278,25 +265,21 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
{
#if defined(IPv6) && defined(AF_INET6)
struct sockaddr_storage socknamev6;
-#endif
+#else
struct sockaddr_in socknamev4;
+#endif
void *socknamePtr;
SOCKLEN_T namelen;
PRMSG (3,"SocketINETGetAddr(%p)\n", ciptr, 0, 0);
#if defined(IPv6) && defined(AF_INET6)
- if (haveIPv6)
- {
- namelen = sizeof(socknamev6);
- socknamePtr = &socknamev6;
- }
- else
+ namelen = sizeof(socknamev6);
+ socknamePtr = &socknamev6;
+#else
+ namelen = sizeof(socknamev4);
+ socknamePtr = &socknamev4;
#endif
- {
- namelen = sizeof(socknamev4);
- socknamePtr = &socknamev4;
- }
bzero(socknamePtr, namelen);
@@ -324,15 +307,10 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
}
#if defined(IPv6) && defined(AF_INET6)
- if (haveIPv6)
- {
- ciptr->family = ((struct sockaddr *)socknamePtr)->sa_family;
- }
- else
+ ciptr->family = ((struct sockaddr *)socknamePtr)->sa_family;
+#else
+ ciptr->family = socknamev4.sin_family;
#endif
- {
- ciptr->family = socknamev4.sin_family;
- }
ciptr->addrlen = namelen;
memcpy (ciptr->addr, socknamePtr, ciptr->addrlen);
@@ -357,7 +335,7 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
SOCKLEN_T namelen;
#if defined(IPv6) && defined(AF_INET6)
- if (haveIPv6 && ciptr->family == AF_INET6)
+ if (ciptr->family == AF_INET6)
{
namelen = sizeof(socknamev6);
socknamePtr = &socknamev6;
@@ -411,14 +389,6 @@ TRANS(SocketOpen) (int i, int type)
PRMSG (3,"SocketOpen(%d,%d)\n", i, type, 0);
-#if defined(IPv6) && defined(AF_INET6)
- if (getaddrinfo == NULL)
- haveIPv6 = 0;
-
- if (!haveIPv6 && Sockettrans2devtab[i].family == AF_INET6)
- return NULL;
-#endif
-
if ((ciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
@@ -1487,7 +1457,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
#endif
#if defined(IPv6) && defined(AF_INET6)
- if (haveIPv6) {
+ {
if (addrlist != NULL) {
if (strcmp(host,addrlist->host) || strcmp(port,addrlist->port)) {
if (addrlist->firstaddr)
@@ -1629,8 +1599,8 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
addrlist->addr = addrlist->addr->ai_next;
}
}
- } else
-#endif
+ }
+#else
{
/*
* Build the socket name.
@@ -1704,6 +1674,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
socketaddr = (struct sockaddr *) &sockname;
socketaddrlen = sizeof(sockname);
}
+#endif
/*
* Turn on socket keepalive so the client process will eventually
@@ -1754,7 +1725,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (olderrno == ECONNREFUSED || olderrno == EINTR
#if defined(IPv6) && defined(AF_INET6)
- || (haveIPv6 && ((addrlist->addr->ai_next != NULL) ||
+ || (((addrlist->addr->ai_next != NULL) ||
(addrlist->addr != addrlist->firstaddr)) &&
(olderrno == ENETUNREACH || olderrno == EAFNOSUPPORT ||
olderrno == EADDRNOTAVAIL || olderrno == ETIMEDOUT
@@ -1800,7 +1771,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
}
#if defined(IPv6) && defined(AF_INET6)
- if (haveIPv6 && res != 0) {
+ if (res != 0) {
addrlist->addr = addrlist->addr->ai_next;
}
#endif
@@ -1824,20 +1795,13 @@ UnixHostReallyLocal (char *host)
{
char hostnamebuf[256];
-#if defined(IPv6) && defined(AF_INET6)
- if (getaddrinfo == NULL)
- haveIPv6 = 0;
-#endif
-
TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf));
if (strcmp (hostnamebuf, host) == 0)
{
return (1);
- }
+ } else {
#if defined(IPv6) && defined(AF_INET6)
- else if (haveIPv6)
- {
struct addrinfo *localhostaddr;
struct addrinfo *otherhostaddr;
struct addrinfo *i, *j;
@@ -1883,10 +1847,7 @@ UnixHostReallyLocal (char *host)
freeaddrinfo(localhostaddr);
freeaddrinfo(otherhostaddr);
return equiv;
- }
-#endif
- else
- {
+#else
/*
* A host may have more than one network address. If any of the
* network addresses of 'host' (specified to the connect call)
@@ -1955,6 +1916,7 @@ UnixHostReallyLocal (char *host)
i++;
}
return (equiv);
+#endif
}
}