VSOCK: Add virtio vsock vsockmon hooks
The virtio drivers deal with struct virtio_vsock_pkt. Add virtio_transport_deliver_tap_pkt(pkt) for handing packets to the vsockmon device. We call virtio_transport_deliver_tap_pkt(pkt) from net/vmw_vsock/virtio_transport.c and drivers/vhost/vsock.c instead of common code. This is because the drivers may drop packets before handing them to common code - we still want to capture them. Signed-off-by: Gerard Garcia <ggarcia@deic.uab.cat> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Jorgen Hansen <jhansen@vmware.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
0b2e66448b
commit
82dfb540ae
@@ -176,6 +176,11 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
|
||||
restart_tx = true;
|
||||
}
|
||||
|
||||
/* Deliver to monitoring devices all correctly transmitted
|
||||
* packets.
|
||||
*/
|
||||
virtio_transport_deliver_tap_pkt(pkt);
|
||||
|
||||
virtio_transport_free_pkt(pkt);
|
||||
}
|
||||
if (added)
|
||||
@@ -383,6 +388,9 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
|
||||
|
||||
len = pkt->len;
|
||||
|
||||
/* Deliver to monitoring devices all received packets */
|
||||
virtio_transport_deliver_tap_pkt(pkt);
|
||||
|
||||
/* Only accept correctly addressed packets */
|
||||
if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid)
|
||||
virtio_transport_recv_pkt(pkt);
|
||||
|
Reference in New Issue
Block a user