From: Dmitry V. Levin Date: Sat, 16 Sep 2017 17:44:29 +0000 (+0000) Subject: netlink: implement decoding of INET_DIAG_CLASS_ID attribute X-Git-Tag: v4.20~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2baaf7302e6046b2c5300eaa4a298084ac9df0eb;p=strace netlink: implement decoding of INET_DIAG_CLASS_ID attribute This is a new netlink attribute introduced by linux kernel commit v4.14-rc1~130^2~207. * linux/inet_diag.h (INET_DIAG_CLASS_ID): New enum. * netlink_inet_diag.c (inet_diag_msg_nla_decoders): Add INET_DIAG_CLASS_ID. * xlat/inet_diag_attrs.in: Add INET_DIAG_CLASS_ID. * xlat/inet_diag_extended_flags.in: Add 1<<(INET_DIAG_CLASS_ID-1). * tests/nlattr_inet_diag_msg.c (main): Check INET_DIAG_CLASS_ID decoding. --- diff --git a/linux/inet_diag.h b/linux/inet_diag.h index ec6356c2..d2eec2ce 100644 --- a/linux/inet_diag.h +++ b/linux/inet_diag.h @@ -106,6 +106,7 @@ enum { INET_DIAG_PAD, INET_DIAG_MARK, INET_DIAG_BBRINFO, + INET_DIAG_CLASS_ID, }; /* INET_DIAG_MEM */ diff --git a/netlink_inet_diag.c b/netlink_inet_diag.c index 700cbd3b..cffe3f5a 100644 --- a/netlink_inet_diag.c +++ b/netlink_inet_diag.c @@ -388,7 +388,8 @@ static const nla_decoder_t inet_diag_msg_nla_decoders[] = { [INET_DIAG_PEERS] = NULL, /* unimplemented */ [INET_DIAG_PAD] = NULL, [INET_DIAG_MARK] = decode_nla_u32, - [INET_DIAG_BBRINFO] = decode_tcp_bbr_info + [INET_DIAG_BBRINFO] = decode_tcp_bbr_info, + [INET_DIAG_CLASS_ID] = decode_nla_u32 }; DECL_NETLINK_DIAG_DECODER(decode_inet_diag_msg) diff --git a/tests/nlattr_inet_diag_msg.c b/tests/nlattr_inet_diag_msg.c index 5666d74b..ccc62aed 100644 --- a/tests/nlattr_inet_diag_msg.c +++ b/tests/nlattr_inet_diag_msg.c @@ -182,6 +182,11 @@ main(void) INET_DIAG_MARK, pattern, mark, printf("%u", mark)); + TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, + init_inet_diag_msg, print_inet_diag_msg, + INET_DIAG_CLASS_ID, pattern, mark, + printf("%u", mark)); + static const uint8_t shutdown = 0xcd; TEST_NLATTR(fd, nlh0, hdrlen, init_inet_diag_msg, print_inet_diag_msg, INET_DIAG_SHUTDOWN, diff --git a/xlat/inet_diag_attrs.in b/xlat/inet_diag_attrs.in index 17519c83..4536ebc3 100644 --- a/xlat/inet_diag_attrs.in +++ b/xlat/inet_diag_attrs.in @@ -16,3 +16,4 @@ INET_DIAG_PEERS INET_DIAG_PAD INET_DIAG_MARK INET_DIAG_BBRINFO +INET_DIAG_CLASS_ID diff --git a/xlat/inet_diag_extended_flags.in b/xlat/inet_diag_extended_flags.in index 05be3ca4..182cac16 100644 --- a/xlat/inet_diag_extended_flags.in +++ b/xlat/inet_diag_extended_flags.in @@ -15,3 +15,4 @@ 1<<(INET_DIAG_PAD-1) 1<<(INET_DIAG_MARK-1) 1<<(INET_DIAG_BBRINFO-1) +1<<(INET_DIAG_CLASS_ID-1)