[PATCH v2] netlink: fix NLMSG_DONE never enter family specific decoder

JingPiao Chen chenjingpiao at gmail.com
Mon Jun 26 14:59:11 UTC 2017


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?

--
JingPiao Chen




More information about the Strace-devel mailing list