]> granicus.if.org Git - strace/commitdiff
tests: check decoding of rtnetlink dcb messages
authorJingPiao Chen <chenjingpiao@gmail.com>
Sun, 13 Aug 2017 02:27:27 +0000 (10:27 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 14 Aug 2017 01:09:51 +0000 (01:09 +0000)
* tests/netlink_route.c: Include <linux/dcbnl.h>.
(test_rtnl_dcb): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
tests/netlink_route.c

index f0ec9384d39923bd681721d7d57b07af311189f1..0cdb945a7a94645dacd30d72e43eb80059aa0078 100644 (file)
@@ -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
@@ -391,6 +394,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/");
@@ -414,6 +433,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");