From f7c60460262fe0be1dbe17e7f2f7bdba6a0e65a4 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Fri, 25 May 2018 14:36:35 +0200 Subject: [PATCH] tests: check decoding of IFLA_EVENT netlink attribute * tests/nlattr_ifinfomsg.c (main): Add a check for IFLA_EVENT attribute decoding. --- tests/nlattr_ifinfomsg.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/nlattr_ifinfomsg.c b/tests/nlattr_ifinfomsg.c index fde9f8c4..9706dea9 100644 --- a/tests/nlattr_ifinfomsg.c +++ b/tests/nlattr_ifinfomsg.c @@ -46,6 +46,7 @@ # define IFLA_VF_PORTS 24 #endif #define IFLA_LINK_NETNSID 37 +#define IFLA_EVENT 44 #ifndef IFLA_INFO_KIND # define IFLA_INFO_KIND 1 @@ -344,6 +345,22 @@ main(void) printf("{nla_len=%u, nla_type=IFLA_VF_PORT}", nla.nla_len)); + static const struct { + uint32_t val; + const char *str; + } ifla_events[] = { + { 0, "IFLA_EVENT_NONE" }, + { 6, "IFLA_EVENT_BONDING_OPTIONS" }, + { ARG_STR(0x7) " /* IFLA_EVENT_??? */" }, + { ARG_STR(0xdeadfeed) " /* IFLA_EVENT_??? */" }, + }; + for (size_t i = 0; i < ARRAY_SIZE(ifla_events); i++) { + TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, + init_ifinfomsg, print_ifinfomsg, + IFLA_EVENT, pattern, ifla_events[i].val, + printf("%s", ifla_events[i].str)); + } + puts("+++ exited with 0 +++"); return 0; } -- 2.40.0