rtnl_link: implement IFLA_EVENT_* decoding

* rtnl_link.c (decode_ifla_event): New function.
(ifinfomsg_nla_decoders) <[IFLA_EVENT]>: Use it.
* xlat/rtnl_ifla_events.in: New file.
* NEWS: Mention it.
This commit is contained in:
Eugene Syromyatnikov 2018-02-12 19:58:47 +01:00 committed by Dmitry V. Levin
parent 2e5510da5f
commit 53ebefe984
3 changed files with 26 additions and 1 deletions

1
NEWS
View File

@ -7,6 +7,7 @@ Noteworthy changes in release ?.?? (????-??-??)
* Improvements
* IPv6 addresses shown in socket information in -yy mode are now printed
in brackets.
* Enhanced NETLINK_ROUTE protocol decoding.
* Updated the list of RWF_* constants.
* Bug fixes

View File

@ -39,6 +39,7 @@
#include <linux/rtnetlink.h>
#include "xlat/rtnl_ifla_brport_attrs.h"
#include "xlat/rtnl_ifla_events.h"
#include "xlat/rtnl_ifla_info_attrs.h"
#include "xlat/rtnl_ifla_port_attrs.h"
#include "xlat/rtnl_ifla_vf_port_attrs.h"
@ -375,6 +376,22 @@ decode_ifla_xdp(struct tcb *const tcp,
return true;
}
static bool
decode_ifla_event(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
uint32_t ev;
if (len < sizeof(ev))
return false;
else if (!umove_or_printaddr(tcp, addr, &ev))
printxval(rtnl_ifla_events, ev, "IFLA_EVENT_???");
return true;
}
static const nla_decoder_t ifinfomsg_nla_decoders[] = {
[IFLA_ADDRESS] = NULL, /* unimplemented */
[IFLA_BROADCAST] = NULL, /* unimplemented */
@ -419,7 +436,7 @@ static const nla_decoder_t ifinfomsg_nla_decoders[] = {
[IFLA_GSO_MAX_SIZE] = decode_nla_u32,
[IFLA_PAD] = NULL,
[IFLA_XDP] = decode_ifla_xdp,
[IFLA_EVENT] = decode_nla_u32
[IFLA_EVENT] = decode_ifla_event,
};
DECL_NETLINK_ROUTE_DECODER(decode_ifinfomsg)

7
xlat/rtnl_ifla_events.in Normal file
View File

@ -0,0 +1,7 @@
IFLA_EVENT_NONE 0
IFLA_EVENT_REBOOT 1
IFLA_EVENT_FEATURES 2
IFLA_EVENT_BONDING_FAILOVER 3
IFLA_EVENT_NOTIFY_PEERS 4
IFLA_EVENT_IGMP_RESEND 5
IFLA_EVENT_BONDING_OPTIONS 6