[PATCH 19/26] tests: check decoding of rtnetlink dcb messages

JingPiao Chen chenjingpiao at gmail.com
Thu Aug 10 01:10:16 UTC 2017


* tests/netlink_route.c: Include <linux/dcbnl.h>.
(test_rtnl_dcb): 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 1df09c8..0658f1e 100644
--- a/tests/netlink_route.c
+++ b/tests/netlink_route.c
@@ -32,6 +32,9 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include "test_netlink.h"
+#ifdef HAVE_LINUX_DCBNL_H
+# include <linux/dcbnl.h>
+#endif
 #ifdef HAVE_LINUX_FIB_RULES_H
 # include <linux/fib_rules.h>
 #endif
@@ -388,6 +391,22 @@ test_rtnl_addrlabel(const int fd)
 }
 #endif
 
+#ifdef HAVE_STRUCT_DCBMSG
+static void
+test_rtnl_dcb(const int fd)
+{
+	void *const nlh0 = tail_alloc(NLMSG_HDRLEN);
+	static const struct dcbmsg msg = {
+		.dcb_family = AF_UNIX,
+		.cmd = DCB_CMD_UNDEFINED
+	};
+
+	TEST_NL_ROUTE(fd, nlh0, RTM_GETDCB, msg,
+		      printf("{dcb_family=AF_UNIX"),
+		      printf(", cmd=DCB_CMD_UNDEFINED}"));
+}
+#endif
+
 int main(void)
 {
 	skip_if_unavailable("/proc/self/fd/");
@@ -411,6 +430,9 @@ int main(void)
 #ifdef HAVE_STRUCT_IFADDRLBLMSG
 	test_rtnl_addrlabel(fd);
 #endif
+#ifdef HAVE_STRUCT_DCBMSG
+	test_rtnl_dcb(fd);
+#endif
 
 	printf("+++ exited with 0 +++\n");
 
-- 
2.7.4





More information about the Strace-devel mailing list