[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211021123714.1125384-8-marcandre.lureau@redhat.com>
Date: Thu, 21 Oct 2021 16:37:11 +0400
From: Marc-André Lureau <marcandre.lureau@...hat.com>
To: netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, sgarzare@...hat.com,
davem@...emloft.net, kuba@...nel.org,
Marc-André Lureau <marcandre.lureau@...hat.com>
Subject: [PATCH 07/10] vsock/loopback: implement copy_peercred()
Signed-off-by: Marc-André Lureau <marcandre.lureau@...hat.com>
---
net/vmw_vsock/vsock_loopback.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/vmw_vsock/vsock_loopback.c b/net/vmw_vsock/vsock_loopback.c
index 169a8cf65b39..59317baa4e5c 100644
--- a/net/vmw_vsock/vsock_loopback.c
+++ b/net/vmw_vsock/vsock_loopback.c
@@ -41,6 +41,12 @@ static int vsock_loopback_send_pkt(struct virtio_vsock_pkt *pkt)
return len;
}
+static void vsock_loopback_copy_peercred(struct sock *sk, struct virtio_vsock_pkt *pkt)
+{
+ /* on vsock loopback, set both peers by swaping the creds */
+ sock_swap_peercred(sk, sk_vsock(pkt->vsk));
+}
+
static int vsock_loopback_cancel_pkt(struct vsock_sock *vsk)
{
struct vsock_loopback *vsock = &the_vsock_loopback;
@@ -110,6 +116,7 @@ static struct virtio_transport loopback_transport = {
},
.send_pkt = vsock_loopback_send_pkt,
+ .copy_peercred = vsock_loopback_copy_peercred,
};
static bool vsock_loopback_seqpacket_allow(u32 remote_cid)
--
2.33.0.721.g106298f7f9
Powered by blists - more mailing lists