On Mon, Jun 26, 2017 at 10:29:40AM +0800, JingPiao Chen wrote: > * netlink.c (print_nlmsghdr): Add condition > nlmsghdr->nlmsg_type != NLMSG_DONE. > (decode_nlmsg_type): Add condition type != NLMSG_DONE. > (decode_nlmsg_flags): Add condition type == NLMSG_DONE. > (decode_netlink_sock_diag): Add condition > nlmsghdr->nlmsg_type == NLMSG_DONE.
Now I don't follow. What do you want to do with NLMSG_DONE messages, pass them to family specific decoders or not? Ditto with other control messages, do you want to pass them to family specific decoders or not? > --- > netlink.c | 9 +++++++-- > netlink_sock_diag.c | 3 +++ > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/netlink.c b/netlink.c > index 87b389c..f74c3a0 100644 > --- a/netlink.c > +++ b/netlink.c > @@ -177,7 +177,7 @@ decode_nlmsg_type(const uint16_t type, const unsigned int > family) > const struct xlat *xlat = netlink_types; > const char *dflt = "NLMSG_???"; > > - if (family < ARRAY_SIZE(nlmsg_types)) { > + if (type != NLMSG_DONE && family < ARRAY_SIZE(nlmsg_types)) { > if (nlmsg_types[family].decoder) > decoder = nlmsg_types[family].decoder; > if (nlmsg_types[family].xlat) > @@ -194,6 +194,9 @@ decode_nlmsg_flags(const uint16_t flags, const uint16_t > type, const int family) > { > const struct xlat *table = NULL; > > + if (type == NLMSG_DONE) > + goto end; > + > switch (family) { > case NETLINK_SOCK_DIAG: > table = netlink_get_flags; > @@ -233,6 +236,7 @@ decode_nlmsg_flags(const uint16_t flags, const uint16_t > type, const int family) > break; > } > > +end: > printflags_ex(flags, "NLM_F_???", netlink_flags, table, NULL); > } > > @@ -246,7 +250,8 @@ print_nlmsghdr(struct tcb *tcp, > > tprintf("{len=%u, type=", nlmsghdr->nlmsg_len); > > - const int hdr_family = (nlmsghdr->nlmsg_type < NLMSG_MIN_TYPE) > + const int hdr_family = (nlmsghdr->nlmsg_type < NLMSG_MIN_TYPE > + && nlmsghdr->nlmsg_type != NLMSG_DONE) > ? NL_FAMILY_DEFAULT > : (family != NL_FAMILY_DEFAULT > ? family : get_fd_nl_family(tcp, fd)); > diff --git a/netlink_sock_diag.c b/netlink_sock_diag.c > index d854808..4b096f8 100644 > --- a/netlink_sock_diag.c > +++ b/netlink_sock_diag.c > @@ -536,6 +536,9 @@ decode_netlink_sock_diag(struct tcb *const tcp, > { > uint8_t family; > > + if (nlmsghdr->nlmsg_type == NLMSG_DONE) > + return false; > + > if (!umove_or_printaddr(tcp, addr, &family)) { > if (family < ARRAY_SIZE(diag_decoders) > && len > sizeof(family)) { -- ldv
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