[PATCH v3 17/18] netlink: decode AF_INET inet_diag_req attributes
Dmitry V. Levin
ldv at altlinux.org
Sat Jul 1 10:43:11 UTC 2017
On Wed, Jun 28, 2017 at 10:08:46AM +0800, JingPiao Chen wrote:
> * netlink_sock_diag.c: Include "xlat/inet_diag_bytecodes.h".
> (inet_diag_req_nla_decoders): New array.
> (decode_inet_diag_req_compat, decode_inet_diag_req_v2): Use it.
> * linux/inet_diag.h (inet_diag_bc_op, inet_diag_hostcond,
> inet_diag_markcond): New structures.
> (INET_DIAG_BC_*): New enum.
> * xlat/inet_diag_bytecodes.in: New file.
> ---
> linux/inet_diag.h | 32 ++++++++
> netlink_sock_diag.c | 176 +++++++++++++++++++++++++++++++++++++++++++-
> xlat/inet_diag_bytecodes.in | 11 +++
> 3 files changed, 217 insertions(+), 2 deletions(-)
> create mode 100644 xlat/inet_diag_bytecodes.in
>
> diff --git a/linux/inet_diag.h b/linux/inet_diag.h
> index 24302db..ec6356c 100644
> --- a/linux/inet_diag.h
> +++ b/linux/inet_diag.h
> @@ -39,6 +39,38 @@ enum {
> INET_DIAG_REQ_BYTECODE,
> };
>
> +struct inet_diag_bc_op {
> + unsigned char code;
> + unsigned char yes;
> + unsigned short no;
> +};
> +
> +enum {
> + INET_DIAG_BC_NOP,
> + INET_DIAG_BC_JMP,
> + INET_DIAG_BC_S_GE,
> + INET_DIAG_BC_S_LE,
> + INET_DIAG_BC_D_GE,
> + INET_DIAG_BC_D_LE,
> + INET_DIAG_BC_AUTO,
> + INET_DIAG_BC_S_COND,
> + INET_DIAG_BC_D_COND,
> + INET_DIAG_BC_DEV_COND, /* u32 ifindex */
> + INET_DIAG_BC_MARK_COND,
> +};
> +
> +struct inet_diag_hostcond {
> + uint8_t family;
> + uint8_t prefix_len;
> + int port;
> + uint32_t addr[0];
> +};
> +
> +struct inet_diag_markcond {
> + uint32_t mark;
> + uint32_t mask;
> +};
> +
> /* Info structure */
> struct inet_diag_msg {
> uint8_t idiag_family;
[...]
> diff --git a/xlat/inet_diag_bytecodes.in b/xlat/inet_diag_bytecodes.in
> new file mode 100644
> index 0000000..e75f424
> --- /dev/null
> +++ b/xlat/inet_diag_bytecodes.in
> @@ -0,0 +1,11 @@
> +INET_DIAG_BC_NOP 0
> +INET_DIAG_BC_JMP 1
> +INET_DIAG_BC_S_GE 2
> +INET_DIAG_BC_S_LE 3
> +INET_DIAG_BC_D_GE 4
> +INET_DIAG_BC_D_LE 5
> +INET_DIAG_BC_AUTO 6
> +INET_DIAG_BC_S_COND 7
> +INET_DIAG_BC_D_COND 8
> +INET_DIAG_BC_DEV_COND 9
> +INET_DIAG_BC_MARK_COND 10
Haven't these constants just been defined in local linux/inet_diag.h?
--
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/20170701/19e7ad51/attachment.bin>
More information about the Strace-devel
mailing list