* tests/nlattr_ndmsg.c (NDA_PORT): New macro. (main): Check decoding of NDA_DST, NDA_CACHEINFO and NDA_PORT. --- tests/nlattr_ndmsg.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/tests/nlattr_ndmsg.c b/tests/nlattr_ndmsg.c index adf5147..d968888 100644 --- a/tests/nlattr_ndmsg.c +++ b/tests/nlattr_ndmsg.c @@ -35,6 +35,8 @@ #endif #include <linux/rtnetlink.h> +#define NDA_PORT 6 + static void init_ndmsg(struct nlmsghdr *const nlh, const unsigned int msg_len) { @@ -87,6 +89,33 @@ main(void) 4, pattern, 4, print_quoted_hex(pattern, 4)); + TEST_NLATTR(fd, nlh0, hdrlen, + init_ndmsg, print_ndmsg, + NDA_DST, 4, pattern, 4, + print_quoted_hex(pattern, 4)); + + static const struct nda_cacheinfo ci = { + .ndm_confirmed = 0xabcdedad, + .ndm_used = 0xbcdaedad, + .ndm_updated = 0xcdbadeda, + .ndm_refcnt = 0xdeadbeda + }; + + TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, + init_ndmsg, print_ndmsg, + NDA_CACHEINFO, pattern, ci, + PRINT_FIELD_U("{", ci, ndm_confirmed); + PRINT_FIELD_U(", ", ci, ndm_used); + PRINT_FIELD_U(", ", ci, ndm_updated); + PRINT_FIELD_U(", ", ci, ndm_refcnt); + printf("}")); + + const uint16_t port = 0xabcd; + TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, + init_ndmsg, print_ndmsg, + NDA_PORT, pattern, port, + printf("htobe16(%u)", be16toh(port))); + puts("+++ exited with 0 +++"); return 0; } -- 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