From: JingPiao Chen Date: Tue, 15 Aug 2017 04:41:20 +0000 (+0800) Subject: netlink: add basic decoding of NETLINK_ROUTE netconfmsg attributes X-Git-Tag: v4.19~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1569f4cfe51245799f721da9886f94c3d83aa021;p=strace netlink: add basic decoding of NETLINK_ROUTE netconfmsg attributes * rtnl_netconf.c: Include "netlink.h", "nlattr.h", and "xlat/rtnl_netconf_attrs.h". (decode_netconfmsg): Call decode_nlattr. * xlat/rtnl_netconf_attrs.in: New file. Co-authored-by: Fabien Siron --- diff --git a/rtnl_netconf.c b/rtnl_netconf.c index 852e908d..7e9b173b 100644 --- a/rtnl_netconf.c +++ b/rtnl_netconf.c @@ -32,9 +32,13 @@ #ifdef HAVE_STRUCT_NETCONFMSG # include "netlink_route.h" +# include "nlattr.h" # include "print_fields.h" # include +# include "netlink.h" + +# include "xlat/rtnl_netconf_attrs.h" DECL_NETLINK_ROUTE_DECODER(decode_netconfmsg) { @@ -42,6 +46,14 @@ DECL_NETLINK_ROUTE_DECODER(decode_netconfmsg) PRINT_FIELD_XVAL("{", ncm, ncm_family, addrfams, "AF_???"); tprints("}"); + + const size_t offset = NLMSG_ALIGN(sizeof(ncm)); + if (len > offset) { + tprints(", "); + decode_nlattr(tcp, addr + offset, len - offset, + rtnl_netconf_attrs, "NETCONFA_???", + NULL, 0, NULL); + } } #endif diff --git a/xlat/rtnl_netconf_attrs.in b/xlat/rtnl_netconf_attrs.in new file mode 100644 index 00000000..b376b78e --- /dev/null +++ b/xlat/rtnl_netconf_attrs.in @@ -0,0 +1,8 @@ +NETCONFA_UNSPEC 0 +NETCONFA_IFINDEX 1 +NETCONFA_FORWARDING 2 +NETCONFA_RP_FILTER 3 +NETCONFA_MC_FORWARDING 4 +NETCONFA_PROXY_NEIGH 5 +NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN 6 +NETCONFA_INPUT 7