ASSERT(vsk->localAddr.svm_port == pkt->dstPort);
VSockAddr_Init(&vpending->localAddr,
- VMCI_GetContextID(),
+ VMCI_HANDLE_TO_CONTEXT_ID(pkt->dg.dst),
pkt->dstPort);
VSockAddr_Init(&vpending->remoteAddr,
VMCI_HANDLE_TO_CONTEXT_ID(pkt->dg.src),
goto destroy;
}
+ /*
+ * At this point we know the CID the peer is using to talk to us.
+ */
+
+ if (vsk->localAddr.svm_cid == VMADDR_CID_ANY) {
+ vsk->localAddr.svm_cid = VMCI_HANDLE_TO_CONTEXT_ID(pkt->dg.dst);
+ }
+
/*
* Setup the notify ops to be the highest supported version that both the
* server and the client support.
}
}
- /*
- * For the client stream sockets, we always want to make sure that
- * we have a specific context id.
- */
- if (vsk->localAddr.svm_cid == VMADDR_CID_ANY) {
- vsk->localAddr.svm_cid = VMCI_GetContextID();
- }
-
sk->sk_state = SS_CONNECTING;
if (VSockVmciOldProtoOverride(&oldPktProto) && oldPktProto) {