netlink: add basic decoding of NETLINK_ROUTE ndtmsg attributes
* rtnl_neightbl.c: Include "nlattr.h" and "xlat/rtnl_neightbl_attrs.h". (decode_ndtmsg): Call decode_nlattr. * xlat/rtnl_neightbl_attrs.in: New file. Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
This commit is contained in:
parent
daf21282d1
commit
46e2c5226a
@ -29,6 +29,7 @@
|
||||
|
||||
#include "defs.h"
|
||||
#include "netlink_route.h"
|
||||
#include "nlattr.h"
|
||||
#include "print_fields.h"
|
||||
|
||||
#include "netlink.h"
|
||||
@ -37,10 +38,19 @@
|
||||
# include <linux/neighbour.h>
|
||||
#endif
|
||||
|
||||
#include "xlat/rtnl_neightbl_attrs.h"
|
||||
|
||||
DECL_NETLINK_ROUTE_DECODER(decode_ndtmsg)
|
||||
{
|
||||
struct ndtmsg ndtmsg = { .ndtm_family = family };
|
||||
|
||||
PRINT_FIELD_XVAL("{", ndtmsg, ndtm_family, addrfams, "AF_???");
|
||||
tprints("}");
|
||||
|
||||
const size_t offset = NLMSG_ALIGN(sizeof(ndtmsg));
|
||||
if (len > offset) {
|
||||
tprints(", ");
|
||||
decode_nlattr(tcp, addr + offset, len - offset,
|
||||
rtnl_neightbl_attrs, "NDTA_???", NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
10
xlat/rtnl_neightbl_attrs.in
Normal file
10
xlat/rtnl_neightbl_attrs.in
Normal file
@ -0,0 +1,10 @@
|
||||
NDTA_UNSPEC 0
|
||||
NDTA_NAME 1
|
||||
NDTA_THRESH1 2
|
||||
NDTA_THRESH2 3
|
||||
NDTA_THRESH3 4
|
||||
NDTA_CONFIG 5
|
||||
NDTA_PARMS 6
|
||||
NDTA_STATS 7
|
||||
NDTA_GC_INTERVAL 8
|
||||
NDTA_PAD 9
|
Loading…
Reference in New Issue
Block a user