[PATCH RFC net-next v4 08/11] vsock/virtio: add netns hooks
From: Bobby Eshleman <hidden>
Date: 2025-06-17 04:33:07
Also in:
kvm, linux-kselftest, lkml, virtualization
Subsystem:
networking [general], the rest, virtio and vhost vsock driver, virtio core, vm sockets (af_vsock) · Maintainers:
"David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Stefan Hajnoczi, Stefano Garzarella, "Michael S. Tsirkin", Jason Wang
From: Bobby Eshleman <redacted>
This changes virtio to not be broken by new internal API changes
required for NS support on the host side. virtio-vsock namespaces are
always global mode, so behavior is unchanged for them.
Signed-off-by: Bobby Eshleman <redacted>
---
net/vmw_vsock/virtio_transport.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index f0e48e6911fc..25c1bca7b136 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -536,7 +536,7 @@ static bool virtio_transport_msgzerocopy_allow(void)
return true;
}
-static bool virtio_transport_seqpacket_allow(u32 remote_cid);
+static bool virtio_transport_seqpacket_allow(struct vsock_sock *vsk, u32 remote_cid);
static struct virtio_transport virtio_transport = {
.transport = {@@ -593,7 +593,7 @@ static struct virtio_transport virtio_transport = {
.can_msgzerocopy = virtio_transport_can_msgzerocopy,
};
-static bool virtio_transport_seqpacket_allow(u32 remote_cid)
+static bool virtio_transport_seqpacket_allow(struct vsock_sock *vsk, u32 remote_cid)
{
struct virtio_vsock *vsock;
bool seqpacket_allow;@@ -649,6 +649,7 @@ static void virtio_transport_rx_work(struct work_struct *work)
}
virtio_vsock_skb_rx_put(skb);
+ virtio_vsock_skb_set_net(skb, vsock_global_net());
virtio_transport_deliver_tap_pkt(skb);
virtio_transport_recv_pkt(&virtio_transport, skb);
}
--
2.47.1