]> granicus.if.org Git - strace/commitdiff
tests: check decoding of NLMSG_DONE messages of NETLINK_ROUTE
authorJingPiao Chen <chenjingpiao@gmail.com>
Thu, 10 Aug 2017 01:03:23 +0000 (09:03 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 11 Aug 2017 15:50:14 +0000 (15:50 +0000)
* tests/netlink_route.c (test_nlmsg_done): New function.
(main): Use it.

tests/netlink_route.c

index 2d8f0318dbe9260804f06173ee05e4971289d487..0a52dbc5a34db4de1e0d2b14fe060e116e1b8e75 100644 (file)
@@ -128,6 +128,17 @@ test_nlmsg_flags(const int fd)
               (unsigned) sizeof(nlh), sprintrc(rc));
 }
 
+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)
 {
@@ -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);