]> granicus.if.org Git - strace/commitdiff
rtnl_link: implement IFLA_EVENT_* decoding
authorEugene Syromyatnikov <evgsyr@gmail.com>
Mon, 12 Feb 2018 18:58:47 +0000 (19:58 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 27 Feb 2018 13:14:38 +0000 (13:14 +0000)
* 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
rtnl_link.c
xlat/rtnl_ifla_events.in [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index d0e395894715b229e4da2fa4b616508a9a4c5e5a..cd1d62947a2ab1260e697ce5a30e7426aaa24e16 100644 (file)
--- 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
index 2e13fce59a83cd27d70dec2858784330708de659..b2ebde2ba23ed5d148f631a8fdad7c9d04c2e05e 100644 (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)
diff --git a/xlat/rtnl_ifla_events.in b/xlat/rtnl_ifla_events.in
new file mode 100644 (file)
index 0000000..487b6ac
--- /dev/null
@@ -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