]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Extend AsyncSocket code to handle a "network unreachable" error on a Linux
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:59 +0000 (11:22 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:59 +0000 (11:22 -0700)
connect() system call.
  modified: lib/asyncsocket/asyncSocketInt.h, lib/asyncsocket/asyncWebSocket.c,
            lib/asyncsocket/asyncsocket.c, lib/include/asyncsocket.h,

Changes to common header files; not applicable to open-vm-tools.

Reorder the includes in services/plugins/dndcp/xutils/xutils.cc to build
with Gtk+ 3.x at a later date.

open-vm-tools/lib/asyncsocket/asyncSocketInt.h
open-vm-tools/lib/asyncsocket/asyncsocket.c
open-vm-tools/lib/include/asyncsocket.h
open-vm-tools/lib/include/vm_product_versions.h
open-vm-tools/modules/shared/vmxnet/vmxnet3_defs.h
open-vm-tools/services/plugins/dndcp/xutils/xutils.cc

index 7567c72d5fb5d12647ed7494e0fea784aaef6b28..e6015edf23a92c872bc9d8036707bb881273f18f 100644 (file)
@@ -99,6 +99,7 @@
 #define ASOCK_EADDRINUSE        WSAEADDRINUSE
 #define ASOCK_ECONNECTING       WSAEWOULDBLOCK
 #define ASOCK_EWOULDBLOCK       WSAEWOULDBLOCK
+#define ASOCK_ENETUNREACH       WSAENETUNREACH
 #else
 #define ASOCK_LASTERROR()       errno
 #define ASOCK_ENOTCONN          ENOTCONN
 #define ASOCK_EADDRINUSE        EADDRINUSE
 #define ASOCK_ECONNECTING       EINPROGRESS
 #define ASOCK_EWOULDBLOCK       EWOULDBLOCK
+#define ASOCK_ENETUNREACH       ENETUNREACH
 #endif
 
 #define WEBSOCKET_HTTP_BUFFER_SIZE  8192
@@ -473,6 +475,16 @@ AsyncSocket *AsyncSocketListenerCreate(const char *addrStr,
                                        Bool webSockUseSSL,
                                        const char *protocols[],
                                        int *outError);
+AsyncSocket *AsyncSocketListenerCreateImpl(const char *addrStr,
+                                           unsigned int port,
+                                           int socketFamily,
+                                           AsyncSocketConnectFn connectFn,
+                                           void *clientData,
+                                           AsyncSocketPollParams *pollParams,
+                                           Bool isWebSock,
+                                           Bool webSockUseSSL,
+                                           const char *protocols[],
+                                           int *outError);
 
 AsyncSocketState AsyncSocketGetState(AsyncSocket *sock);
 int AsyncSocketGetGenericErrno(AsyncSocket *s);
index afbaa35bd59cfef1476f9824a24e4676a7c05328..1a78531808783d8672ec168a60dd18631738d1d2 100644 (file)
@@ -418,6 +418,12 @@ AsyncSocket_MsgError(int asyncSockError)   // IN
    case ASOCKERR_CONNECTSSL:
       result = MSGID(asyncsocket.connectssl) "Connection error: could not negotiate SSL";
       break;
+   case ASOCKERR_NETUNREACH:
+      result = MSGID(asyncsocket.netunreach) "Network unreachable";
+      break;
+   case ASOCKERR_ADDRUNRESV:
+      result = MSGID(asyncsocket.addrunresv) "Address unresolvable";
+      break;
    }
 
    if (!result) {
@@ -1986,7 +1992,13 @@ AsyncSocketConnectWithAsock(AsyncSocket *asock,
          sysErr = ASOCK_LASTERROR();
          Log(ASOCKPREFIX "connect failed, error %d: %s\n",
              sysErr, Err_Errno2String(sysErr));
-         error = ASOCKERR_CONNECT;
+
+         /*
+          * If "network unreachable" error happens, explicitly propogate
+          * the error to trigger the reconnection if possible.
+          */
+         error = (sysErr == ASOCK_ENETUNREACH) ? ASOCKERR_NETUNREACH :
+                                                 ASOCKERR_CONNECT;
          goto errorHaveAsock;
       }
    } else {
index 059379fedb2dd717ba9684f5ddf22006101da1cb..07bf8a75a6a44257612f5236814de1274d3fac3f 100644 (file)
@@ -70,6 +70,8 @@
 #define ASOCKERR_BINDADDRINUSE     11
 #define ASOCKERR_LISTEN            12
 #define ASOCKERR_CONNECTSSL        13
+#define ASOCKERR_NETUNREACH        14
+#define ASOCKERR_ADDRUNRESV        15
 
 
 /*
@@ -242,6 +244,18 @@ AsyncSocket *AsyncSocket_ListenWebSocket(const char *addrStr,
                                          void *clientData,
                                          AsyncSocketPollParams *pollParams,
                                          int *outError);
+/*
+ * Listen on port and fire callback with new asock
+ * NOTE - Do not use this API.
+ * Listens on 127.0.0.1:port and does not use SSL.
+ * This API will be deprecated soon.
+ */
+AsyncSocket *AsyncSocket_ListenWebSocketNoHttp(unsigned int port,
+                                             const char *protocols[],
+                                             AsyncSocketConnectFn connectFn,
+                                             void *clientData,
+                                             AsyncSocketPollParams *pollParams,
+                                             int *outError);
 #ifndef _WIN32
 AsyncSocket *AsyncSocket_ListenWebSocketUDS(const char *pipeName,
                                             Bool useSSL,
index 76cd8817a3b1a62d99a04716b0d330d510b62fb3..21490143848bb4f6b4eea8b7e426e26584d5cdf9 100644 (file)
@@ -39,7 +39,7 @@
 #if defined(VMX86_VIEWCLIENT)
    #define PRODUCT_VERSION    4,1,0,PRODUCT_BUILD_NUMBER_NUMERIC
 #elif defined(VMX86_VMRC) /* check VMX86_VMRC before VMX86_DESKTOP */
-   #define PRODUCT_VERSION    8,0,0,PRODUCT_BUILD_NUMBER_NUMERIC   /* VMRC_VERSION_NUMBER below has to match this */
+   #define PRODUCT_VERSION    8,1,0,PRODUCT_BUILD_NUMBER_NUMERIC   /* VMRC_VERSION_NUMBER below has to match this */
 #elif defined(VMX86_FLEX) /* check VMX86_FLEX before VMX86_DESKTOP */
    #define PRODUCT_VERSION    8,0,0,PRODUCT_BUILD_NUMBER_NUMERIC   /* FLEX_VERSION_NUMBER below has to match this */
 #elif defined(VMX86_TOOLS)
 #define WORKSTATION_VERSION "e.x.p"
 #define PLAYER_VERSION_NUMBER "12.0.0" /* this version number should always match real Player version number */
 #define PLAYER_VERSION "e.x.p"
-#define VMRC_VERSION_NUMBER "8.0.0" /* this version number should always match real VMRC version number */
-#define VMRC_VERSION "8.0.0"
+#define VMRC_VERSION_NUMBER "8.1.0" /* this version number should always match real VMRC version number */
+#define VMRC_VERSION "8.1.0"
 #define FLEX_CLIENT_VERSION_NUMBER "8.0.0"
 #define FLEX_CLIENT_VERSION "e.x.p"
 
  */
 #define PRODUCT_MAC_DESKTOP_VERSION_STRING_FOR_LICENSE "8.0"
 #define PRODUCT_PLAYER_VERSION_STRING_FOR_LICENSE "12.0"
-#define PRODUCT_VMRC_VERSION_STRING_FOR_LICENSE "8.0"
+#define PRODUCT_VMRC_VERSION_STRING_FOR_LICENSE "8.1"
 #define PRODUCT_FLEX_VERSION_STRING_FOR_LICENSE "8.0"
 
 #if defined(VMX86_TOOLS)
index 886006271b502dff6a5682950fac0b439cac410c..f6327c1deea244d044b7e97e77bc3a2d01834989 100644 (file)
@@ -136,7 +136,8 @@ typedef enum {
    VMXNET3_CMD_GET_DEV_EXTRA_INFO,
    VMXNET3_CMD_GET_CONF_INTR,
    VMXNET3_CMD_GET_ADAPTIVE_RING_INFO,
-   VMXNET3_CMD_GET_TXDATA_DESC_SIZE
+   VMXNET3_CMD_GET_TXDATA_DESC_SIZE,
+   VMXNET3_CMD_GET_COALESCE
 } Vmxnet3_Cmd;
 
 /* Adaptive Ring Info Flags */
@@ -615,11 +616,10 @@ enum vmxnet3_intr_type {
 #define VMXNET3_COAL_RBC_MAX_RATE            100000
 
 enum Vmxnet3_CoalesceMode {
-   VMXNET3_COALESCE_DEFAULT    = 0,
-   VMXNET3_COALESCE_DISABLED   = 1,
-   VMXNET3_COALESCE_ADAPT      = 2,
-   VMXNET3_COALESCE_STATIC     = 3,
-   VMXNET3_COALESCE_RBC        = 4
+   VMXNET3_COALESCE_DISABLED   = 0,
+   VMXNET3_COALESCE_ADAPT      = 1,
+   VMXNET3_COALESCE_STATIC     = 2,
+   VMXNET3_COALESCE_RBC        = 3
 };
 
 typedef
index 7915ecd9d571fe193ad46b2bfc6897315f6400a6..cc9d95c873198bd030223d8498832f52d5ed32af 100644 (file)
 
 #include <cairomm/cairomm.h>
 #include <gdkmm.h>
+
+#include "xutils/xutils.hh"
+
 #if GTK_MAJOR_VERSION == 3
 #include <gdkmm/devicemanager.h>
 #endif
 
-#include "xutils/xutils.hh"
-
 /* These must be after the gtkmm includes, as gtkmm is quite picky. */
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>