* tests/netlink_route.c: Include <linux/if_addrlabel.h>.
(test_rtnl_addrlabel): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.si...@epita.fr>
---
 tests/netlink_route.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/tests/netlink_route.c b/tests/netlink_route.c
index b921655..1df09c8 100644
--- a/tests/netlink_route.c
+++ b/tests/netlink_route.c
@@ -38,6 +38,9 @@
 #ifdef HAVE_LINUX_IF_ADDR_H
 # include <linux/if_addr.h>
 #endif
+#ifdef HAVE_LINUX_IF_ADDRLABEL_H
+# include <linux/if_addrlabel.h>
+#endif
 #include <linux/if_arp.h>
 #include <linux/ip.h>
 #ifdef HAVE_LINUX_NEIGHBOUR_H
@@ -362,6 +365,29 @@ test_rtnl_tca(const int fd)
                     printf("{tca_family=AF_INET}"));
 }
 
+#ifdef HAVE_STRUCT_IFADDRLBLMSG
+static void
+test_rtnl_addrlabel(const int fd)
+{
+       void *const nlh0 = tail_alloc(NLMSG_HDRLEN);
+       const struct ifaddrlblmsg msg = {
+               .ifal_family = AF_UNIX,
+               .ifal_prefixlen = 0xaf,
+               .ifal_flags = 0xbd,
+               .ifal_index = IFINDEX_LO,
+               .ifal_seq = 0xfadcdafb
+       };
+
+       TEST_NL_ROUTE(fd, nlh0, RTM_GETADDRLABEL, msg,
+                     printf("{ifal_family=AF_UNIX"),
+                     PRINT_FIELD_U(", ", msg, ifal_prefixlen);
+                     PRINT_FIELD_U(", ", msg, ifal_flags);
+                     printf(", ifal_index=if_nametoindex(\"lo\")");
+                     PRINT_FIELD_U(", ", msg, ifal_seq);
+                     printf("}"));
+}
+#endif
+
 int main(void)
 {
        skip_if_unavailable("/proc/self/fd/");
@@ -382,6 +408,9 @@ int main(void)
        test_rtnl_neightbl(fd);
        test_rtnl_tc(fd);
        test_rtnl_tca(fd);
+#ifdef HAVE_STRUCT_IFADDRLBLMSG
+       test_rtnl_addrlabel(fd);
+#endif
 
        printf("+++ exited with 0 +++\n");
 
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to