From 53ebefe984d97ecf99bf7550e9afde68f9cce72a Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Mon, 12 Feb 2018 19:58:47 +0100 Subject: [PATCH] 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. --- NEWS | 1 + rtnl_link.c | 19 ++++++++++++++++++- xlat/rtnl_ifla_events.in | 7 +++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 xlat/rtnl_ifla_events.in diff --git a/NEWS b/NEWS index d0e39589..cd1d6294 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/rtnl_link.c b/rtnl_link.c index 2e13fce5..b2ebde2b 100644 --- a/rtnl_link.c +++ b/rtnl_link.c @@ -39,6 +39,7 @@ #include #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) diff --git a/xlat/rtnl_ifla_events.in b/xlat/rtnl_ifla_events.in new file mode 100644 index 00000000..487b6ac2 --- /dev/null +++ b/xlat/rtnl_ifla_events.in @@ -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 -- 2.40.0