From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: netdev@vger.kernel.org, Zhu Yanjun <zyjzyj2000@gmail.com>,
Gerard Garcia <ggarcia@abra.uab.cat>,
Jorgen Hansen <jhansen@vmware.com>
Subject: Re: [PATCH v3 2/3] VSOCK: Add vsockmon device
Date: Wed, 12 Apr 2017 19:43:20 +0300 [thread overview]
Message-ID: <20170412193827-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170412160825.21037-3-stefanha@redhat.com>
On Wed, Apr 12, 2017 at 05:08:24PM +0100, Stefan Hajnoczi wrote:
> From: Gerard Garcia <ggarcia@deic.uab.cat>
>
> Add vsockmon virtual network device that receives packets from the vsock
> transports and exposes them to user space.
>
> Based on the nlmon device.
>
> Signed-off-by: Gerard Garcia <ggarcia@deic.uab.cat>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> v3:
> * Fix DEFAULT_MTU macro definition [Zhu Yanjun]
> * Rename af_vsockmon_hdr->t field ->transport for clarity
> * Update .ndo_get_stats64() return type since it has changed
> ---
> drivers/net/Makefile | 1 +
> include/uapi/linux/vsockmon.h | 57 ++++++++++++++
> drivers/net/vsockmon.c | 167 ++++++++++++++++++++++++++++++++++++++++++
> drivers/net/Kconfig | 8 ++
> include/uapi/linux/Kbuild | 1 +
> 5 files changed, 234 insertions(+)
> create mode 100644 include/uapi/linux/vsockmon.h
> create mode 100644 drivers/net/vsockmon.c
>
> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> index 98ed4d9..2d54930 100644
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -30,6 +30,7 @@ obj-$(CONFIG_GENEVE) += geneve.o
> obj-$(CONFIG_GTP) += gtp.o
> obj-$(CONFIG_NLMON) += nlmon.o
> obj-$(CONFIG_NET_VRF) += vrf.o
> +obj-$(CONFIG_VSOCKMON) += vsockmon.o
>
> #
> # Networking Drivers
> diff --git a/include/uapi/linux/vsockmon.h b/include/uapi/linux/vsockmon.h
> new file mode 100644
> index 0000000..484e59e
> --- /dev/null
> +++ b/include/uapi/linux/vsockmon.h
> @@ -0,0 +1,57 @@
> +#ifndef _UAPI_VSOCKMON_H
> +#define _UAPI_VSOCKMON_H
> +
> +#include <linux/virtio_vsock.h>
> +
> +/*
> + * vsockmon is the AF_VSOCK packet capture device. Packets captured have the
> + * following layout:
> + *
> + * +-----------------------------------+
> + * | vsockmon header |
> + * | (struct af_vsockmon_hdr) |
> + * +-----------------------------------+
> + * | transport header |
> + * | (af_vsockmon_hdr->len bytes long) |
> + * +-----------------------------------+
> + * | payload |
> + * | (until end of packet) |
> + * +-----------------------------------+
> + *
> + * The vsockmon header is a transport-independent description of the packet.
> + * It duplicates some of the information from the transport header so that
> + * no transport-specific knowledge is necessary to process packets.
> + *
> + * The transport header is useful for low-level transport-specific packet
> + * analysis. Transport type is given in af_vsockmon_hdr->transport and
> + * transport header length is given in af_vsockmon_hdr->len.
> + *
> + * If af_vsockmon_hdr->op is AF_VSOCK_OP_PAYLOAD then the payload follows the
> + * transport header. Other ops do not have a payload.
> + */
> +
> +struct af_vsockmon_hdr {
> + __le64 src_cid;
> + __le64 dst_cid;
> + __le32 src_port;
> + __le32 dst_port;
> + __le16 op; /* enum af_vsockmon_op */
> + __le16 transport; /* enum af_vsockmon_transport */
> + __le16 len; /* Transport header length */
> +} __attribute__((packed));
I'd add a 2 byte padding here and then you do not need to pack it.
next prev parent reply other threads:[~2017-04-12 16:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-12 16:08 [PATCH v3 0/3] VSOCK: vsockmon virtual device to monitor AF_VSOCK sockets Stefan Hajnoczi
2017-04-12 16:08 ` [PATCH v3 1/3] VSOCK: Add vsockmon tap functions Stefan Hajnoczi
2017-04-12 16:37 ` Michael S. Tsirkin
2017-04-13 15:01 ` Stefan Hajnoczi
2017-04-12 16:08 ` [PATCH v3 2/3] VSOCK: Add vsockmon device Stefan Hajnoczi
2017-04-12 16:43 ` Michael S. Tsirkin [this message]
2017-04-12 17:05 ` David Miller
2017-04-13 15:02 ` Stefan Hajnoczi
2017-04-12 16:08 ` [PATCH v3 3/3] VSOCK: Add virtio vsock vsockmon hooks Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170412193827-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=ggarcia@abra.uab.cat \
--cc=jhansen@vmware.com \
--cc=netdev@vger.kernel.org \
--cc=stefanha@redhat.com \
--cc=zyjzyj2000@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).