Skip to content

Commit

Permalink
vsock: add VMADDR_CID_LOCAL definition
Browse files Browse the repository at this point in the history
The VMADDR_CID_RESERVED (1) was used by VMCI, but now it is not
used anymore, so we can reuse it for local communication
(loopback) adding the new well-know CID: VMADDR_CID_LOCAL.

Cc: Jorgen Hansen <jhansen@vmware.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stefano Garzarella authored and David S. Miller committed Dec 11, 2019
1 parent c5144fc commit ef343b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions include/uapi/linux/vm_sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@

#define VMADDR_CID_HYPERVISOR 0

/* This CID is specific to VMCI and can be considered reserved (even VMCI
* doesn't use it anymore, it's a legacy value from an older release).
/* Use this as the destination CID in an address when referring to the
* local communication (loopback).
* (This was VMADDR_CID_RESERVED, but even VMCI doesn't use it anymore,
* it was a legacy value from an older release).
*/

#define VMADDR_CID_RESERVED 1
#define VMADDR_CID_LOCAL 1

/* Use this as the destination CID in an address when referring to the host
* (any process other than the hypervisor). VMCI relies on it being 2, but
Expand Down
2 changes: 1 addition & 1 deletion net/vmw_vsock/vmci_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ static int vmci_transport_recv_dgram_cb(void *data, struct vmci_datagram *dg)
static bool vmci_transport_stream_allow(u32 cid, u32 port)
{
static const u32 non_socket_contexts[] = {
VMADDR_CID_RESERVED,
VMADDR_CID_LOCAL,
};
int i;

Expand Down

0 comments on commit ef343b3

Please sign in to comment.