]> granicus.if.org Git - strace/commitdiff
tests: check decoding of rtnetlink nsid messages
authorJingPiao Chen <chenjingpiao@gmail.com>
Sun, 13 Aug 2017 02:29:03 +0000 (10:29 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 14 Aug 2017 01:10:33 +0000 (01:10 +0000)
* tests/netlink_route.c (test_rtnl_nsid): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
tests/netlink_route.c

index 64fc73ad4e07c5742fd6e957b6c4bba237c07bb7..5b60a17bca8c97c07d291fd2784fcfff91946740 100644 (file)
@@ -447,6 +447,22 @@ test_rtnl_mdb(const int fd)
 }
 #endif
 
+#ifdef RTM_NEWNSID
+static void
+test_rtnl_nsid(const int fd)
+{
+       void *const nlh0 = tail_alloc(NLMSG_HDRLEN);
+       static const struct rtgenmsg msg = {
+               .rtgen_family = AF_UNIX
+       };
+
+       TEST_NETLINK(fd, nlh0,
+                    RTM_GETNSID, NLM_F_REQUEST,
+                    sizeof(msg), &msg, sizeof(msg),
+                    printf("{rtgen_family=AF_UNIX}"));
+}
+#endif
+
 int main(void)
 {
        skip_if_unavailable("/proc/self/fd/");
@@ -479,6 +495,9 @@ int main(void)
 #ifdef HAVE_STRUCT_BR_PORT_MSG
        test_rtnl_mdb(fd);
 #endif
+#ifdef RTM_NEWNSID
+       test_rtnl_nsid(fd);
+#endif
 
        printf("+++ exited with 0 +++\n");