[PATCH v2 7/7] rtnl_nsid: decode rtgenmsg netlink attributes
JingPiao Chen
chenjingpiao at gmail.com
Tue Aug 29 07:45:23 UTC 2017
* rtnl_nsid.c (rtgenmsg_nla_decoders): New array.
(decode_rtgenmsg): Use it.
---
rtnl_nsid.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/rtnl_nsid.c b/rtnl_nsid.c
index e3fe18b..51ce37b 100644
--- a/rtnl_nsid.c
+++ b/rtnl_nsid.c
@@ -37,6 +37,12 @@
#include "xlat/rtnl_nsid_attrs.h"
+static const nla_decoder_t rtgenmsg_nla_decoders[] = {
+ [NETNSA_NSID] = decode_nla_s32,
+ [NETNSA_PID] = decode_nla_u32,
+ [NETNSA_FD] = decode_nla_u32
+};
+
DECL_NETLINK_ROUTE_DECODER(decode_rtgenmsg)
{
struct rtgenmsg rtgenmsg = { .rtgen_family = family };
@@ -48,6 +54,8 @@ DECL_NETLINK_ROUTE_DECODER(decode_rtgenmsg)
if (len > offset) {
tprints(", ");
decode_nlattr(tcp, addr + offset, len - offset,
- rtnl_nsid_attrs, "NETNSA_???", NULL, 0, NULL);
+ rtnl_nsid_attrs, "NETNSA_???",
+ rtgenmsg_nla_decoders,
+ ARRAY_SIZE(rtgenmsg_nla_decoders), NULL);
}
}
--
2.7.4
More information about the Strace-devel
mailing list