tests: check decoding of rtnetlink dcb messages

* 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>
This commit is contained in:
JingPiao Chen 2017-08-13 10:27:27 +08:00 committed by Dmitry V. Levin
parent b658e89812
commit 9120212f66

View 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");