Messages in this thread | | | Date | Tue, 26 Oct 2021 13:18:35 +0200 | From | Stefano Garzarella <> | Subject | Re: [PATCH 07/10] vsock/loopback: implement copy_peercred() |
| |
On Thu, Oct 21, 2021 at 04:37:11PM +0400, Marc-André Lureau wrote: >Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.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)); >+} >+
It's a bit hacky set also the cred of `pkt->vsk`. I think here we should only copy the cred of the remote peer.
Addind the call to t->copy_peercred() in the virtio_transport_recv_connecting() will set the other side.
Thanks, Stefano
| |