]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Extend vmciRoute with hypervisor to host routing.
authorVMware, Inc <>
Tue, 29 Mar 2011 20:09:25 +0000 (13:09 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 29 Mar 2011 20:09:25 +0000 (13:09 -0700)
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 <mvanzin@vmware.com>
open-vm-tools/modules/linux/vmci/vmciRoute.c

index 84d9c377a72bb690a615107cd642798042671179..7ba4b65592dac1c5a355c370e3d74066b92d901b 100644 (file)
@@ -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) {