[PATCH 21/26] tests: check decoding of rtnetlink netconf messages
JingPiao Chen
chenjingpiao at gmail.com
Thu Aug 10 01:10:18 UTC 2017
* tests/netlink_route.c: Include <linux/netconf.h>.
(test_rtnl_netconf): New function.
(main): Use it.
Co-authored-by: Fabien Siron <fabien.siron at epita.fr>
---
tests/netlink_route.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/netlink_route.c b/tests/netlink_route.c
index 0658f1e..d51d9e2 100644
--- a/tests/netlink_route.c
+++ b/tests/netlink_route.c
@@ -49,6 +49,9 @@
#ifdef HAVE_LINUX_NEIGHBOUR_H
# include <linux/neighbour.h>
#endif
+#ifdef HAVE_LINUX_NETCONF_H
+# include <linux/netconf.h>
+#endif
#include <linux/rtnetlink.h>
#ifdef HAVE_IF_INDEXTONAME
@@ -407,6 +410,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/");
@@ -433,6 +452,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");
--
2.7.4
More information about the Strace-devel
mailing list