From: JingPiao Chen Date: Sun, 13 Aug 2017 02:22:26 +0000 (+0800) Subject: tests: check decoding of rtnetlink neigh messages X-Git-Tag: v4.19~138 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f22c62767846ea4d92a2fd81c88e24de27e8d87;p=strace tests: check decoding of rtnetlink neigh messages * tests/netlink_route.c: Include . (test_rtnl_neigh): New function. (main): Use it. Co-authored-by: Fabien Siron --- diff --git a/tests/netlink_route.c b/tests/netlink_route.c index 9996f948..62d5570c 100644 --- a/tests/netlink_route.c +++ b/tests/netlink_route.c @@ -40,6 +40,9 @@ #endif #include #include +#ifdef HAVE_LINUX_NEIGHBOUR_H +# include +#endif #include #ifdef HAVE_IF_INDEXTONAME @@ -293,6 +296,26 @@ test_rtnl_rule(const int fd) } #endif +static void +test_rtnl_neigh(const int fd) +{ + void *const nlh0 = tail_alloc(NLMSG_HDRLEN); + const struct ndmsg msg = { + .ndm_family = AF_UNIX, + .ndm_ifindex = IFINDEX_LO, + .ndm_state = NUD_PERMANENT, + .ndm_flags = NTF_PROXY, + .ndm_type = NDA_UNSPEC + }; + + TEST_NL_ROUTE(fd, nlh0, RTM_GETNEIGH, msg, + printf("{ndm_family=AF_UNIX"), + printf(", ndm_ifindex=if_nametoindex(\"lo\")" + ", ndm_state=NUD_PERMANENT" + ", ndm_flags=NTF_PROXY" + ", ndm_type=NDA_UNSPEC}")); +} + int main(void) { skip_if_unavailable("/proc/self/fd/"); @@ -309,6 +332,7 @@ int main(void) #ifdef HAVE_LINUX_FIB_RULES_H test_rtnl_rule(fd); #endif + test_rtnl_neigh(fd); printf("+++ exited with 0 +++\n");