[PATCH 25/26] tests: check decoding of rtnetlink nsid messages

JingPiao Chen chenjingpiao at gmail.com
Thu Aug 10 01:13:03 UTC 2017


* tests/netlink_route.c (test_rtnl_nsid): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron at epita.fr>
---
 tests/netlink_route.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/netlink_route.c b/tests/netlink_route.c
index fa5f060..71abbcd 100644
--- a/tests/netlink_route.c
+++ b/tests/netlink_route.c
@@ -444,6 +444,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/");
@@ -476,6 +492,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");
 
-- 
2.7.4





More information about the Strace-devel mailing list