On Mon, Jun 26, 2017 at 06:08:40PM +0300, Dmitry V. Levin wrote: > On Mon, Jun 26, 2017 at 10:59:11PM +0800, JingPiao Chen wrote: > > On Mon, Jun 26, 2017 at 05:48:41PM +0300, Dmitry V. Levin wrote: > > > On Mon, Jun 26, 2017 at 10:22:10PM +0800, JingPiao Chen wrote: > > > > On Mon, Jun 26, 2017 at 05:03:41PM +0300, Dmitry V. Levin wrote: > > > > > 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? > > > > > > > > Pass them to family specific decoders. > > > > > > > > > Ditto with other control messages, do you want to pass them to family > > > > > specific decoders or not? > > > > > > > > Do not pass them to family specific decoders. > > > > > > In that case ... > > > > > > > --- 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) > > > > > > ... this hunk does something different from what you want because > > > messages of type == NLMSG_DONE are not passed to the family specific > > > decoder. > > > > I do not pass them to family specific nlmsg_types_decoder_t, > > only pass them to family specific netlink_decoder_t. > > Is this idea not easy to understand? > > This is not quite obvious. Would you like to describe your intention > in the commit message, please?
Ok, I want know what do you think. On "[PATCH] netlink: decode NLMSG_DONE message" you wrote: > I suggest implementing a default decoder of NLMSG_DONE messages that > would print the integer in case of len == sizeof(int) and fall back > to printstrn for other lengths. > > When protocol specific netlink decoders are added, they could either > decode NLMSG_DONE themselves (and return true) or just return false to > fall back to default decoder. Are you know the code never enter family specific decoder or I misunderstood your intention? If want to pass type == NLMSG_DONE to family specific netlink_decoder, must get family when type == NLMSG_DONE. I do not pass type == NLMSG_DONE to family specific nlmsg_types_decoder because default decoder can handle it, and if pass them to family specific nlmsg_types_decoder need each family write a nlmsg_types_decoder. commit message: While many NLMSG_DONE messages indeed have payload containing just one integer, there are exceptions. So should pass type == NLMSG_DONE to family specific netlink decoder. -- JingPiao Chen ------------------------------------------------------------------------------ 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