OSDN Git Service

af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path
authorAndra Paraschiv <andraprs@amazon.com>
Mon, 14 Dec 2020 16:11:21 +0000 (18:11 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 15 Dec 2020 03:33:39 +0000 (19:33 -0800)
commit1b5f2ab98e7f99f1a83960b17c5596012a7c5e88
tree001ae077acc0911fbd69cfc18d2d7aee717e35d6
parentcada7ccd9dc75fc73de9342ae1dd0374e8fb1056
af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path

The vsock flags can be set during the connect() setup logic, when
initializing the vsock address data structure variable. Then the vsock
transport is assigned, also considering this flags field.

The vsock transport is also assigned on the (listen) receive path. The
flags field needs to be set considering the use case.

Set the value of the vsock flags of the remote address to the one
targeted for packets forwarding to the host, if the following conditions
are met:

* The source CID of the packet is higher than VMADDR_CID_HOST.
* The destination CID of the packet is higher than VMADDR_CID_HOST.

Changelog

v3 -> v4

* No changes.

v2 -> v3

* No changes.

v1 -> v2

* Set the vsock flag on the receive path in the vsock transport
  assignment logic.
* Use bitwise operator for the vsock flag setup.
* Use the updated "VMADDR_FLAG_TO_HOST" flag naming.

Signed-off-by: Andra Paraschiv <andraprs@amazon.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/vmw_vsock/af_vsock.c