tests: check decoding of rtnetlink mdb messages
* tests/netlink_route.c: Include <netinet/in.h> and <linux/if_bridge.h>. (test_rtnl_mdb): New function. (main): Use it. Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include "test_netlink.h"
|
#include "test_netlink.h"
|
||||||
#ifdef HAVE_LINUX_DCBNL_H
|
#ifdef HAVE_LINUX_DCBNL_H
|
||||||
# include <linux/dcbnl.h>
|
# include <linux/dcbnl.h>
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
# include <linux/if_addrlabel.h>
|
# include <linux/if_addrlabel.h>
|
||||||
#endif
|
#endif
|
||||||
#include <linux/if_arp.h>
|
#include <linux/if_arp.h>
|
||||||
|
#include <linux/if_bridge.h>
|
||||||
#include <linux/ip.h>
|
#include <linux/ip.h>
|
||||||
#ifdef HAVE_LINUX_NEIGHBOUR_H
|
#ifdef HAVE_LINUX_NEIGHBOUR_H
|
||||||
# include <linux/neighbour.h>
|
# include <linux/neighbour.h>
|
||||||
@@ -429,6 +431,22 @@ test_rtnl_netconf(const int fd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRUCT_BR_PORT_MSG
|
||||||
|
static void
|
||||||
|
test_rtnl_mdb(const int fd)
|
||||||
|
{
|
||||||
|
void *const nlh0 = tail_alloc(NLMSG_HDRLEN);
|
||||||
|
const struct br_port_msg msg = {
|
||||||
|
.family = AF_UNIX,
|
||||||
|
.ifindex = IFINDEX_LO
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_NL_ROUTE(fd, nlh0, RTM_GETMDB, msg,
|
||||||
|
printf("{family=AF_UNIX"),
|
||||||
|
printf(", ifindex=if_nametoindex(\"lo\")}"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
skip_if_unavailable("/proc/self/fd/");
|
skip_if_unavailable("/proc/self/fd/");
|
||||||
@@ -458,6 +476,9 @@ int main(void)
|
|||||||
#ifdef HAVE_STRUCT_NETCONFMSG
|
#ifdef HAVE_STRUCT_NETCONFMSG
|
||||||
test_rtnl_netconf(fd);
|
test_rtnl_netconf(fd);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_STRUCT_BR_PORT_MSG
|
||||||
|
test_rtnl_mdb(fd);
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("+++ exited with 0 +++\n");
|
printf("+++ exited with 0 +++\n");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user