netlink: add basic decoding of NETLINK_ROUTE tcamsg attributes
* rtnl_tc_action.c: Include "nlattr.h" and "xlat/rtnl_tc_action_attrs.h". (decode_tcamsg): Call decode_nlattr. * xlat/rtnl_tc_action_attrs.in: New file. Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
This commit is contained in:
parent
7506c69c3a
commit
41d9c32e95
@ -29,15 +29,26 @@
|
||||
|
||||
#include "defs.h"
|
||||
#include "netlink_route.h"
|
||||
#include "nlattr.h"
|
||||
#include "print_fields.h"
|
||||
|
||||
#include "netlink.h"
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
#include "xlat/rtnl_tc_action_attrs.h"
|
||||
|
||||
DECL_NETLINK_ROUTE_DECODER(decode_tcamsg)
|
||||
{
|
||||
struct tcamsg tca = { .tca_family = family };
|
||||
|
||||
PRINT_FIELD_XVAL("{", tca, tca_family, addrfams, "AF_???");
|
||||
tprints("}");
|
||||
|
||||
const size_t offset = NLMSG_ALIGN(sizeof(tca));
|
||||
if (len > offset) {
|
||||
tprints(", ");
|
||||
decode_nlattr(tcp, addr + offset, len - offset,
|
||||
rtnl_tc_action_attrs, "TCA_ACT_???",
|
||||
NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
7
xlat/rtnl_tc_action_attrs.in
Normal file
7
xlat/rtnl_tc_action_attrs.in
Normal file
@ -0,0 +1,7 @@
|
||||
TCA_ACT_UNSPEC 0
|
||||
TCA_ACT_KIND 1
|
||||
TCA_ACT_OPTIONS 2
|
||||
TCA_ACT_INDEX 3
|
||||
TCA_ACT_STATS 4
|
||||
TCA_ACT_PAD 5
|
||||
TCA_ACT_COOKIE 6
|
Loading…
x
Reference in New Issue
Block a user