[PATCH 01/26] tests: check decoding of NLMSG_DONE messages of NETLINK_ROUTE

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


* tests/netlink_route.c (test_nlmsg_done): New function.
(main): Use it.
---
 tests/netlink_route.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/netlink_route.c b/tests/netlink_route.c
index 2d8f031..0a52dbc 100644
--- a/tests/netlink_route.c
+++ b/tests/netlink_route.c
@@ -129,6 +129,17 @@ test_nlmsg_flags(const int fd)
 }
 
 static void
+test_nlmsg_done(const int fd)
+{
+	void *const nlh0 = tail_alloc(NLMSG_HDRLEN);
+	const int num = 0xabcdefad;
+
+	TEST_NETLINK(fd, nlh0, NLMSG_DONE, NLM_F_REQUEST,
+		     sizeof(num), &num, sizeof(num),
+		     printf("%d", num));
+}
+
+static void
 test_rtnl_unspec(const int fd)
 {
 	void *const nlh0 = tail_alloc(NLMSG_HDRLEN);
@@ -207,6 +218,7 @@ int main(void)
 
 	test_nlmsg_type(fd);
 	test_nlmsg_flags(fd);
+	test_nlmsg_done(fd);
 	test_rtnl_unspec(fd);
 	test_rtnl_link(fd);
 
-- 
2.7.4





More information about the Strace-devel mailing list