* rtnl_tc.c: Include "nlattr.h" and "xlat/rtnl_tc_attrs.h".
(decode_tcmsg): Call decode_nlattr.
* xlat/rtnl_tc_attrs.in: New file.
Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
#include "defs.h"
#include "netlink_route.h"
#include "defs.h"
#include "netlink_route.h"
#include "print_fields.h"
#include "netlink.h"
#include <linux/rtnetlink.h>
#include "print_fields.h"
#include "netlink.h"
#include <linux/rtnetlink.h>
+#include "xlat/rtnl_tc_attrs.h"
+
DECL_NETLINK_ROUTE_DECODER(decode_tcmsg)
{
struct tcmsg tcmsg = { .tcm_family = family };
DECL_NETLINK_ROUTE_DECODER(decode_tcmsg)
{
struct tcmsg tcmsg = { .tcm_family = family };
- const size_t offset = sizeof(tcmsg.tcm_family);
+ size_t offset = sizeof(tcmsg.tcm_family);
+ bool decode_nla = false;
PRINT_FIELD_XVAL("{", tcmsg, tcm_family, addrfams, "AF_???");
PRINT_FIELD_XVAL("{", tcmsg, tcm_family, addrfams, "AF_???");
PRINT_FIELD_U(", ", tcmsg, tcm_handle);
PRINT_FIELD_U(", ", tcmsg, tcm_parent);
PRINT_FIELD_U(", ", tcmsg, tcm_info);
PRINT_FIELD_U(", ", tcmsg, tcm_handle);
PRINT_FIELD_U(", ", tcmsg, tcm_parent);
PRINT_FIELD_U(", ", tcmsg, tcm_info);
}
} else
tprints("...");
tprints("}");
}
} else
tprints("...");
tprints("}");
+
+ offset = NLMSG_ALIGN(sizeof(tcmsg));
+ if (decode_nla && len > offset) {
+ tprints(", ");
+ decode_nlattr(tcp, addr + offset, len - offset,
+ rtnl_tc_attrs, "TCA_???", NULL, 0, NULL);
+ }
--- /dev/null
+TCA_UNSPEC 0
+TCA_KIND 1
+TCA_OPTIONS 2
+TCA_STATS 3
+TCA_XSTATS 4
+TCA_RATE 5
+TCA_FCNT 6
+TCA_STATS2 7
+TCA_STAB 8
+TCA_PAD 9
+TCA_DUMP_INVISIBLE 10
+TCA_CHAIN 11