* tests/nlattr_ifinfomsg.c (IFLA_LINKINFO, IFLA_VF_PORTS,
IFLA_INFO_KIND, IFLA_VF_PORT): New macros.
(main): Check decoding of IFLA_LINKINFO and IFLA_VF_PORTS.
---
 tests/nlattr_ifinfomsg.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/nlattr_ifinfomsg.c b/tests/nlattr_ifinfomsg.c
index 3b2624e..1fff52c 100644
--- a/tests/nlattr_ifinfomsg.c
+++ b/tests/nlattr_ifinfomsg.c
@@ -39,8 +39,22 @@
 #endif
 #include <linux/rtnetlink.h>
 
+#ifndef IFLA_LINKINFO
+# define IFLA_LINKINFO 18
+#endif
+#ifndef IFLA_VF_PORTS
+# define IFLA_VF_PORTS 24
+#endif
 #define IFLA_LINK_NETNSID 37
 
+#ifndef IFLA_INFO_KIND
+# define IFLA_INFO_KIND 1
+#endif
+
+#ifndef IFLA_VF_PORT
+# define IFLA_VF_PORT 1
+#endif
+
 static void
 init_ifinfomsg(struct nlmsghdr *const nlh, const unsigned int msg_len)
 {
@@ -312,6 +326,23 @@ main(void)
 #endif /* HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER */
 #endif /* HAVE_STRUCT_RTNL_LINK_STATS64 */
 
+       struct nlattr nla = {
+               .nla_len = sizeof(nla),
+               .nla_type = IFLA_INFO_KIND,
+       };
+       TEST_NLATTR(fd, nlh0, hdrlen,
+                   init_ifinfomsg, print_ifinfomsg,
+                   IFLA_LINKINFO, sizeof(nla), &nla, sizeof(nla),
+                   printf("{nla_len=%u, nla_type=IFLA_INFO_KIND}",
+                          nla.nla_len));
+
+       nla.nla_type = IFLA_VF_PORT;
+       TEST_NLATTR(fd, nlh0, hdrlen,
+                   init_ifinfomsg, print_ifinfomsg,
+                   IFLA_VF_PORTS, sizeof(nla), &nla, sizeof(nla),
+                   printf("{nla_len=%u, nla_type=IFLA_VF_PORT}",
+                          nla.nla_len));
+
        puts("+++ exited with 0 +++");
        return 0;
 }
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to