[PATCH 11/26] tests: check decoding of rtnetlink neightbl messages
JingPiao Chen
chenjingpiao at gmail.com
Thu Aug 10 01:07:09 UTC 2017
* tests/netlink_route.c: Include <linux/neighbour.h>.
(test_rtnl_neightbl): New function.
(main): Use it.
Co-authored-by: Fabien Siron <fabien.siron at epita.fr>
---
tests/netlink_route.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/netlink_route.c b/tests/netlink_route.c
index 3aba2a0..53f1242 100644
--- a/tests/netlink_route.c
+++ b/tests/netlink_route.c
@@ -40,6 +40,9 @@
#endif
#include <linux/if_arp.h>
#include <linux/ip.h>
+#ifdef HAVE_LINUX_NEIGHBOUR_H
+# include <linux/neighbour.h>
+#endif
#include <linux/rtnetlink.h>
#ifdef HAVE_IF_INDEXTONAME
@@ -310,6 +313,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/");
@@ -327,6 +344,7 @@ int main(void)
test_rtnl_rule(fd);
#endif
test_rtnl_neigh(fd);
+ test_rtnl_neightbl(fd);
printf("+++ exited with 0 +++\n");
--
2.7.4
More information about the Strace-devel
mailing list