From: VMware, Inc <> Date: Wed, 18 Sep 2013 03:42:16 +0000 (-0700) Subject: Provide a kill-switch for using vsocket in RpcChannel. X-Git-Tag: 2013.09.16-1328054~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b81233bd0375e5358a55b387e638e9f569a0cc53;p=thirdparty%2Fopen-vm-tools.git Provide a kill-switch for using vsocket in RpcChannel. Adding "void RpcChannel_SetBackdoorOnly(void)" API to allow to disable vsocket if needed. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/include/vmware/tools/guestrpc.h b/open-vm-tools/lib/include/vmware/tools/guestrpc.h index b90e0b25f..6180c3769 100644 --- a/open-vm-tools/lib/include/vmware/tools/guestrpc.h +++ b/open-vm-tools/lib/include/vmware/tools/guestrpc.h @@ -201,6 +201,9 @@ RpcChannel_SendOne(char **reply, RpcChannel * RpcChannel_New(void); +void +RpcChannel_SetBackdoorOnly(void); + G_END_DECLS /** @} */ diff --git a/open-vm-tools/lib/rpcChannel/rpcChannel.c b/open-vm-tools/lib/rpcChannel/rpcChannel.c index bfa5e23a8..aabb558bd 100644 --- a/open-vm-tools/lib/rpcChannel/rpcChannel.c +++ b/open-vm-tools/lib/rpcChannel/rpcChannel.c @@ -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