* tests/netlink_route.c: Add check for
NETLINK_ROUTE get and new flags.
* tests/netlink_sock_diag.c: Add check for
NETLINK_SOCK_DIAG get flags.
* tests/netlink_xfrm.c: Add check for
NETLINK_XFRM get and new flags.
---
 tests/netlink_route.c     | 26 ++++++++++++++++++++++++++
 tests/netlink_sock_diag.c | 18 ++++++++++++++++++
 tests/netlink_xfrm.c      | 26 ++++++++++++++++++++++++++
 3 files changed, 70 insertions(+)

diff --git a/tests/netlink_route.c b/tests/netlink_route.c
index 7946121..0198e8a 100644
--- a/tests/netlink_route.c
+++ b/tests/netlink_route.c
@@ -50,6 +50,31 @@ test_nlmsg_type(const int fd)
               fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc));
 }
 
+static void
+test_nlmsg_flags(const int fd)
+{
+       long rc;
+       struct nlmsghdr nlh = {
+               .nlmsg_len = sizeof(nlh),
+       };
+
+       nlh.nlmsg_type = RTM_GETLINK;
+       nlh.nlmsg_flags = NLM_F_DUMP;
+       rc = sendto(fd, &nlh, sizeof(nlh), MSG_DONTWAIT, NULL, 0);
+       printf("sendto(%d, {{len=%u, type=RTM_GETLINK"
+              ", flags=NLM_F_DUMP, seq=0, pid=0}}"
+              ", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
+              fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc));
+
+       nlh.nlmsg_type = RTM_NEWLINK;
+       nlh.nlmsg_flags = NLM_F_REPLACE;
+       rc = sendto(fd, &nlh, sizeof(nlh), MSG_DONTWAIT, NULL, 0);
+       printf("sendto(%d, {{len=%u, type=RTM_NEWLINK"
+              ", flags=NLM_F_REPLACE, seq=0, pid=0}}"
+              ", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
+              fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc));
+}
+
 int main(void)
 {
        skip_if_unavailable("/proc/self/fd/");
@@ -57,6 +82,7 @@ int main(void)
        int fd = create_nl_socket(NETLINK_ROUTE);
 
        test_nlmsg_type(fd);
+       test_nlmsg_flags(fd);
 
        printf("+++ exited with 0 +++\n");
 
diff --git a/tests/netlink_sock_diag.c b/tests/netlink_sock_diag.c
index 09eb2bf..943e90b 100644
--- a/tests/netlink_sock_diag.c
+++ b/tests/netlink_sock_diag.c
@@ -55,6 +55,23 @@ test_nlmsg_type(const int fd)
               fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc));
 }
 
+static void
+test_nlmsg_flags(const int fd)
+{
+       long rc;
+       struct nlmsghdr nlh = {
+               .nlmsg_len = sizeof(nlh),
+               .nlmsg_type = SOCK_DIAG_BY_FAMILY,
+               .nlmsg_flags = NLM_F_DUMP,
+       };
+
+       rc = sendto(fd, &nlh, sizeof(nlh), MSG_DONTWAIT, NULL, 0);
+       printf("sendto(%d, {{len=%u, type=SOCK_DIAG_BY_FAMILY"
+              ", flags=NLM_F_DUMP, seq=0, pid=0}}"
+              ", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
+              fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc));
+}
+
 int main(void)
 {
        skip_if_unavailable("/proc/self/fd/");
@@ -62,6 +79,7 @@ int main(void)
        int fd = create_nl_socket(NETLINK_SOCK_DIAG);
 
        test_nlmsg_type(fd);
+       test_nlmsg_flags(fd);
 
        printf("+++ exited with 0 +++\n");
 
diff --git a/tests/netlink_xfrm.c b/tests/netlink_xfrm.c
index fa50080..7183230 100644
--- a/tests/netlink_xfrm.c
+++ b/tests/netlink_xfrm.c
@@ -51,6 +51,31 @@ test_nlmsg_type(const int fd)
               fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc));
 }
 
+static void
+test_nlmsg_flags(const int fd)
+{
+       long rc;
+       struct nlmsghdr nlh = {
+               .nlmsg_len = sizeof(nlh),
+       };
+
+       nlh.nlmsg_type = XFRM_MSG_GETSA;
+       nlh.nlmsg_flags = NLM_F_DUMP;
+       rc = sendto(fd, &nlh, sizeof(nlh), MSG_DONTWAIT, NULL, 0);
+       printf("sendto(%d, {{len=%u, type=XFRM_MSG_GETSA"
+              ", flags=NLM_F_DUMP, seq=0, pid=0}}"
+              ", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
+              fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc));
+
+       nlh.nlmsg_type = XFRM_MSG_NEWSA;
+       nlh.nlmsg_flags = NLM_F_REPLACE;
+       rc = sendto(fd, &nlh, sizeof(nlh), MSG_DONTWAIT, NULL, 0);
+       printf("sendto(%d, {{len=%u, type=XFRM_MSG_NEWSA"
+              ", flags=NLM_F_REPLACE, seq=0, pid=0}}"
+              ", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
+              fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc));
+}
+
 int main(void)
 {
        skip_if_unavailable("/proc/self/fd/");
@@ -58,6 +83,7 @@ int main(void)
        int fd = create_nl_socket(NETLINK_XFRM);
 
        test_nlmsg_type(fd);
+       test_nlmsg_flags(fd);
 
        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