From: VMware, Inc <> Date: Wed, 18 Sep 2013 03:42:24 +0000 (-0700) Subject: Allow for future use of AF_UNSPEC in AsyncSocket library X-Git-Tag: 2013.09.16-1328054~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06b51461bb1a2e01282d0244ff0f47b8d5ae8bea;p=thirdparty%2Fopen-vm-tools.git Allow for future use of AF_UNSPEC in AsyncSocket library Create a socketFamily switch in AsyncSocket_Connect and AsyncSocket_ConnectWebSocket for future IPv6 integration. Allow for future use of AF_UNSPEC when a connection does not care if it is AF_INET or AF_INET6. Since AsyncSocket does not fully support AF_INET6 yet and our AF_INET6 test bed is not yet completed, hard code all callers to AF_INET. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c index d10b527ab..6eedc4ed5 100644 --- a/open-vm-tools/lib/asyncsocket/asyncsocket.c +++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c @@ -1051,8 +1051,8 @@ error: * * AsyncSocket_Connect -- * - * AsyncSocket AF_INET constructor. This is just a wrapper for ConnectIP - * that does hostname -> IP address lookup. + * AsyncSocket AF_INET/AF_INET6 constructor. This is just a wrapper for + * ConnectIP that does hostname -> IP address lookup. * * NOTE: This function can block. * @@ -1067,7 +1067,8 @@ error: */ AsyncSocket * -AsyncSocket_Connect(const char *hostname, +AsyncSocket_Connect(int socketFamily, + const char *hostname, unsigned short port, AsyncSocketConnectFn connectFn, void *clientData, @@ -1091,7 +1092,7 @@ AsyncSocket_Connect(const char *hostname, * Resolve the hostname. Handles dotted decimal strings, too. */ - getaddrinfoError = AsyncSocketResolveAddr(hostname, port, AF_INET, + getaddrinfoError = AsyncSocketResolveAddr(hostname, port, socketFamily, SOCK_STREAM, &addr, &ipString); if (0 != getaddrinfoError) { Log(ASOCKPREFIX "Failed to resolve address '%s' and port %u\n", diff --git a/open-vm-tools/lib/include/asyncsocket.h b/open-vm-tools/lib/include/asyncsocket.h index 87858470a..b352eac9b 100644 --- a/open-vm-tools/lib/include/asyncsocket.h +++ b/open-vm-tools/lib/include/asyncsocket.h @@ -239,7 +239,8 @@ AsyncSocket *AsyncSocket_BindUDP(unsigned short port, /* * Connect to address:port and fire callback with new asock */ -AsyncSocket *AsyncSocket_Connect(const char *hostname, +AsyncSocket *AsyncSocket_Connect(int socketFamily, + const char *hostname, unsigned short port, AsyncSocketConnectFn connectFn, void *clientData, @@ -282,7 +283,8 @@ AsyncSocket_ConnectNamedPipe(char *pipeName, AsyncSocketPollParams *pollParams, int *outError); #endif -AsyncSocket *AsyncSocket_ConnectWebSocket(const char *url, +AsyncSocket *AsyncSocket_ConnectWebSocket(int socketFamily, + const char *url, Bool permitUnverifiedSSL, const char *cookies, AsyncSocketConnectFn connectFn,