On Thu, Jun 15, 2017 at 12:30:48PM +0800, JingPiao Chen wrote:
> * tests/netlink_sock_diag.c: Include <linux/netlink_diag.h>.
> (test_netlink_diag_req, test_netlink_diag_msg): New functions.
> (main): Use them.

Thanks, applied with the following changes:

> +     *req = (struct netlink_diag_req) {
> +             .sdiag_family = AF_NETLINK,
> +             .sdiag_protocol = NDIAG_PROTO_ALL,
> +             .ndiag_ino = 0xfacefeed,
> +             .ndiag_show = NDIAG_SHOW_MEMINFO,
> +             .ndiag_cookie = { 0xdeadbeef, 0xbadc0ded },
> +     };

As ndiag_cookie is the last field of the structure, removed trailing comma.

> +     rc = sendto(fd, nlh, nlh->nlmsg_len, MSG_DONTWAIT, NULL, 0);
> +
> +     printf("sendto(%d, {{len=%u, type=SOCK_DIAG_BY_FAMILY"
> +            ", flags=NLM_F_REQUEST, seq=0, pid=0}"
> +            ", {sdiag_family=AF_NETLINK, sdiag_protocol=NDIAG_PROTO_ALL"
> +            ", ndiag_ino=%u, ndiag_show=NDIAG_SHOW_MEMINFO"
> +            ", ndiag_cookie=[%u, %u]}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
> +            fd, nlh->nlmsg_len, 0xfacefeed, 0xdeadbeef,
> +            0xbadc0ded, nlh->nlmsg_len, sprintrc(rc));

Added another case with a different sdiag_protocol for better coverage.

> +     /* short read of netlink_diag_req */
> +     nlh = nlh0 -  (sizeof(*req) - 1);

Stripped extra space.

> +     *msg = (struct netlink_diag_msg) {
> +             .ndiag_family = AF_NETLINK,
> +             .ndiag_type = SOCK_RAW,
> +             .ndiag_protocol = NETLINK_ROUTE,
> +             .ndiag_state = NETLINK_CONNECTED,
> +             .ndiag_portid = 0xbadc0ded,
> +             .ndiag_dst_portid = 0xdeadbeef,
> +             .ndiag_dst_group = 0xfacefeed,
> +             .ndiag_ino = 0xdaeefacd,
> +             .ndiag_cookie = { 0xbadc0ded, 0xdeadbeef },
> +     };

As ndiag_cookie is the last field of the structure, removed trailing comma.


-- 
ldv

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
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