From: JingPiao Chen Date: Sun, 13 Aug 2017 02:27:29 +0000 (+0800) Subject: tests: check decoding of rtnetlink netconf messages X-Git-Tag: v4.19~126 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d4f3fc07510074441439fd040eb0806b0c7969e;p=strace tests: check decoding of rtnetlink netconf messages * tests/netlink_route.c: Include . (test_rtnl_netconf): New function. (main): Use it. Co-authored-by: Fabien Siron --- diff --git a/tests/netlink_route.c b/tests/netlink_route.c index 0cdb945a..2b20d339 100644 --- a/tests/netlink_route.c +++ b/tests/netlink_route.c @@ -49,6 +49,9 @@ #ifdef HAVE_LINUX_NEIGHBOUR_H # include #endif +#ifdef HAVE_STRUCT_NETCONFMSG +# include +#endif #include #ifdef HAVE_IF_INDEXTONAME @@ -410,6 +413,22 @@ test_rtnl_dcb(const int fd) } #endif +#ifdef HAVE_STRUCT_NETCONFMSG +static void +test_rtnl_netconf(const int fd) +{ + void *const nlh0 = tail_alloc(NLMSG_HDRLEN); + static const struct netconfmsg msg = { + .ncm_family = AF_INET + }; + + TEST_NETLINK(fd, nlh0, + RTM_GETNETCONF, NLM_F_REQUEST, + sizeof(msg), &msg, sizeof(msg), + printf("{ncm_family=AF_INET}")); +} +#endif + int main(void) { skip_if_unavailable("/proc/self/fd/"); @@ -436,6 +455,9 @@ int main(void) #ifdef HAVE_STRUCT_DCBMSG test_rtnl_dcb(fd); #endif +#ifdef HAVE_STRUCT_NETCONFMSG + test_rtnl_netconf(fd); +#endif printf("+++ exited with 0 +++\n");