From: VMware, Inc <> Date: Tue, 29 Mar 2011 20:09:25 +0000 (-0700) Subject: Extend vmciRoute with hypervisor to host routing. X-Git-Tag: 2011.03.28-387002~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68e7d7c0e1cf544ad02e2d8f6be592012d84f0d4;p=thirdparty%2Fopen-vm-tools.git Extend vmciRoute with hypervisor to host routing. The vmci routing function was defaulting to VMCI_ROUTE_AS_GUEST, when the hypervisor is the source and the host is the destination. However, vmci events generated locally on the host are sent from hypervisor to host, and should be routed as host communication. Also, a guest would never use the hypervisor context ID as the source, so there is no ambiguity. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/modules/linux/vmci/vmciRoute.c b/open-vm-tools/modules/linux/vmci/vmciRoute.c index 84d9c377a..7ba4b6559 100644 --- a/open-vm-tools/modules/linux/vmci/vmciRoute.c +++ b/open-vm-tools/modules/linux/vmci/vmciRoute.c @@ -144,6 +144,22 @@ VMCI_Route(VMCIHandle *src, // IN/OUT * any ambiguity from the host context. */ + if (src->context == VMCI_HYPERVISOR_CONTEXT_ID) { + /* + * If the hypervisor is the source, this is host local + * communication. The hypervisor may send vmci event + * datagrams to the host itself, but it will never send + * datagrams to an "outer host" through the guest device. + */ + + if (hasHostDevice) { + *route = VMCI_ROUTE_AS_HOST; + return VMCI_SUCCESS; + } else { + return VMCI_ERROR_DEVICE_NOT_FOUND; + } + } + if (!fromGuest && hasGuestDevice) { /* If no source context then use the current. */ if (VMCI_INVALID_ID == src->context) {