[PATCH 3/8] netlink: add a basic socket diag parser of AF_PACKET messages

Dmitry V. Levin ldv at altlinux.org
Tue Jun 13 20:24:40 UTC 2017


On Tue, Jun 13, 2017 at 10:13:20PM +0800, JingPiao Chen wrote:
> * linux/packet_diag.h: New file.
> * Makefile.am (EXTRA_DIST): Add linux/packet_diag.h.

"Add it." would suffice.

> * defs.h (ethernet_protocols): New xlat prototype.
> * netlink_sock_diag.c: Include <linux/packet_diag.h>
> and "xlat/packet_diag_show.h".
> (decode_packet_diag_req, decode_packet_diag_msg): New functions.
> (diag_decoders): Add AF_PACKET.
> * xlat/packet_diag_show.in: New file.
> 
> Co-authored-by: Fabien Siron <fabien.siron at epita.fr>
> ---
>  Makefile.am              |  1 +
>  defs.h                   |  1 +
>  linux/packet_diag.h      | 29 ++++++++++++++++++++++++++++
>  netlink_sock_diag.c      | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
>  xlat/packet_diag_show.in |  6 ++++++
>  5 files changed, 87 insertions(+)
>  create mode 100644 linux/packet_diag.h
>  create mode 100644 xlat/packet_diag_show.in
> 
> diff --git a/Makefile.am b/Makefile.am
> index 2266fa2..75a9828 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -564,6 +564,7 @@ EXTRA_DIST =				\
>  	linux/or1k/set_scno.c		\
>  	linux/or1k/syscallent.h		\
>  	linux/or1k/userent.h		\
> +	linux/packet_diag.h		\
>  	linux/personality.h		\
>  	linux/powerpc/arch_regs.c	\
>  	linux/powerpc/arch_regs.h	\
> diff --git a/defs.h b/defs.h
> index 3b60d3d..f7d25f0 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -291,6 +291,7 @@ extern const struct xlat addrfams[];
>  extern const struct xlat at_flags[];
>  extern const struct xlat clocknames[];
>  extern const struct xlat dirent_types[];
> +extern const struct xlat ethernet_protocols[];
>  extern const struct xlat evdev_abs[];
>  extern const struct xlat msg_flags[];
>  extern const struct xlat netlink_protocols[];
> diff --git a/linux/packet_diag.h b/linux/packet_diag.h
> new file mode 100644
> index 0000000..24d0694
> --- /dev/null
> +++ b/linux/packet_diag.h
> @@ -0,0 +1,29 @@
> +#ifndef STRACE_LINUX_PACKET_DIAG_H
> +#define STRACE_LINUX_PACKET_DIAG_H
> +
> +struct packet_diag_req {
> +	uint8_t sdiag_family;
> +	uint8_t sdiag_protocol;
> +	uint16_t pad;
> +	uint32_t pdiag_ino;
> +	uint32_t pdiag_show;
> +	uint32_t pdiag_cookie[2];
> +};
> +
> +#define PACKET_SHOW_INFO	0x00000001 /* Basic packet_sk information */
> +#define PACKET_SHOW_MCLIST	0x00000002 /* A set of packet_diag_mclist-s */
> +#define PACKET_SHOW_RING_CFG	0x00000004 /* Rings configuration parameters */

These comments are irrelevant for strace.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170613/ab107efd/attachment.bin>


More information about the Strace-devel mailing list