]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Provide a kill-switch for using vsocket in RpcChannel.
authorVMware, Inc <>
Wed, 18 Sep 2013 03:42:16 +0000 (20:42 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 23 Sep 2013 05:30:01 +0000 (22:30 -0700)
Adding "void RpcChannel_SetBackdoorOnly(void)" API to allow to disable vsocket
if needed.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/include/vmware/tools/guestrpc.h
open-vm-tools/lib/rpcChannel/rpcChannel.c

index b90e0b25fa04e2982b041f8dd47ff10ba680c7e3..6180c3769dc528ef6a23b34e68e0ef4da2110828 100644 (file)
@@ -201,6 +201,9 @@ RpcChannel_SendOne(char **reply,
 RpcChannel *
 RpcChannel_New(void);
 
+void
+RpcChannel_SetBackdoorOnly(void);
+
 G_END_DECLS
 
 /** @} */
index bfa5e23a81691122f130690b56bed1a19fcaa213..aabb558bd9c58786ae31a1f35cd9d6d93701c9db 100644 (file)
@@ -60,6 +60,7 @@ static RpcChannelCallback gRpcHandlers[] =  {
    { "ping", RpcChannelPing, NULL, NULL, NULL, 0 }
 };
 
+static gboolean gUseBackdoorOnly = FALSE;
 
 /**
  * Handler for a "ping" message. Does nothing.
@@ -627,6 +628,20 @@ RpcChannel_UnregisterCallback(RpcChannel *chan,
 }
 
 
+/**
+ * Force to create backdoor channels only.
+ * This provides a kill-switch to disable vsocket channels if needed.
+ * This needs to be called before RpcChannel_New to take effect.
+ */
+
+void
+RpcChannel_SetBackdoorOnly(void)
+{
+   gUseBackdoorOnly = TRUE;
+   Debug(LGPFX "Using vsocket is disabled.\n");
+}
+
+
 /**
  * Create an RpcChannel instance using a prefered channel implementation,
  * currently this is VSockChannel.
@@ -639,7 +654,7 @@ RpcChannel_New(void)
 {
    RpcChannel *chan;
 #if (defined(__linux__) && !defined(USERWORLD)) || defined(_WIN32)
-   chan = VSockChannel_New();
+   chan = gUseBackdoorOnly ? BackdoorChannel_New() : VSockChannel_New();
 #else
    chan = BackdoorChannel_New();
 #endif