[PATCH v3 7/7] Netlink: handle multi netlink messages

Dmitry V. Levin ldv at altlinux.org
Fri Jun 17 12:24:50 UTC 2016


On Wed, Jun 15, 2016 at 12:43:05PM +0000, Fabien Siron wrote:
> * netlink.c (decode_netlink_or_printaddr_msg): From
> decode_netlink_or_printaddr().
> (decode_netlink_or_printaddr): Call decode_netlink_or_printaddr_msg().
> ---
>  netlink.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/netlink.c b/netlink.c
> index c1a9ad4..7581f2b 100644
> --- a/netlink.c
> +++ b/netlink.c
> @@ -57,8 +57,9 @@ nlmsg_next(struct tcb *tcp, unsigned long nlh, unsigned long *len) {
>  		((char *)(nlh) + NLMSG_ALIGN(nlmsghdr.nlmsg_len));
>  }
>  
> -void
> -decode_netlink(struct tcb *tcp, unsigned long addr, unsigned long size)
> +static void
> +decode_netlink_msg(struct tcb *tcp, unsigned long addr,
> +			    unsigned long size)
>  {
>  	struct nlmsghdr nlmsghdr;
>  
> @@ -89,6 +90,17 @@ decode_netlink(struct tcb *tcp, unsigned long addr, unsigned long size)
>  	tprints("}");
>  }
>  
> +void
> +decode_netlink(struct tcb *tcp, unsigned long addr, unsigned long size) {
> +	if (!nlmsg_ok(tcp, addr, size))
> +		return;
> +
> +	for (; nlmsg_ok(tcp, addr, size);

Why two nlmsg_ok calls in a row?

> +	     addr = nlmsg_next(tcp, addr, &size)) {
> +		decode_netlink_msg(tcp, addr, size);
> +	}

Shouldn't output from subsequent decode_netlink_msg calls be delimited?


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


More information about the Strace-devel mailing list