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

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

index 62d5570ce5a32e42aadf0eff11b6293697bd30cb..929902a065c712bab8b953966dacaacd53d187c7 100644 (file)
@@ -316,6 +316,20 @@ test_rtnl_neigh(const int fd)
                             ", ndm_type=NDA_UNSPEC}"));
 }
 
+static void
+test_rtnl_neightbl(const int fd)
+{
+       void *const nlh0 = tail_alloc(NLMSG_HDRLEN);
+       static const struct ndtmsg msg = {
+               .ndtm_family = AF_NETLINK
+       };
+
+       TEST_NETLINK(fd, nlh0,
+                    RTM_GETNEIGHTBL, NLM_F_REQUEST,
+                    sizeof(msg), &msg, sizeof(msg),
+                    printf("{ndtm_family=AF_NETLINK}"));
+}
+
 int main(void)
 {
        skip_if_unavailable("/proc/self/fd/");
@@ -333,6 +347,7 @@ int main(void)
        test_rtnl_rule(fd);
 #endif
        test_rtnl_neigh(fd);
+       test_rtnl_neightbl(fd);
 
        printf("+++ exited with 0 +++\n");