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

Dmitry V. Levin ldv at altlinux.org
Mon Jun 26 14:48:41 UTC 2017


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.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170626/b585354f/attachment.bin>


More information about the Strace-devel mailing list