]> granicus.if.org Git - strace/commitdiff
tests: check decoding of IFLA_EVENT netlink attribute
authorEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 25 May 2018 12:36:35 +0000 (14:36 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jun 2018 10:10:43 +0000 (10:10 +0000)
* tests/nlattr_ifinfomsg.c (main): Add a check for IFLA_EVENT attribute
decoding.

tests/nlattr_ifinfomsg.c

index fde9f8c4b872a19ee4b401d81e4f829d16a08a6d..9706dea9edb08b92bb24495b44a11686ea7fed05 100644 (file)
@@ -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;
 }