[PATCH v5 2/4] Add a general netlink socket parser

Dmitry V. Levin ldv at altlinux.org
Mon Jun 20 23:26:15 UTC 2016


On Mon, Jun 20, 2016 at 04:06:43PM +0000, Fabien Siron wrote:
> This commit introduces a general socket netlink parser which prints
> the header and a string for the remaining part of the buffer. It doesn't
> handle all the netlink flags and types because the parser needs more
> information. It will be done soon.
> 
> * net.c (printsock): Return family.
> (do_msghdr): Call decode_netlink_iov().

decode_netlink_iov?

> (send, sendto, recv, recvfrom): Call printsockbuf().
> * netlink.c: New file.
> (decode_netlink): New function.
> * defs.h (decode_netlink, getfdproto): Add.

New prototypes.

> (printsock): Change return type.

... to int.

> (iov_decoder): Add IOV_DECODER_NETLINK.

decoder?

> * io.c (print_iovec): Call decode_netlink().
> * util.c (getfdproto): Remove the static keyword to the function.

Just "Remove static keyword" is enough.

> * Makefile.am (strace_SOURCES): Add netlink.c.
> * xlat/netlink_flags.in: New file.
> * xlat/netlink_types.in: New file.
[...]
> @@ -926,10 +948,12 @@ SYS_FUNC(recv)
>  		printfd(tcp, tcp->u_arg[0]);
>  		tprints(", ");
>  	} else {
> -		if (syserror(tcp))
> -			printaddr(tcp->u_arg[1]);
> -		else
> -			printstr(tcp, tcp->u_arg[1], tcp->u_rval);
> +		if (syserror(tcp)) {
> +		       printaddr(tcp->u_arg[1]);

Something went wrong with indentation of this printaddr call.


-- 
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/20160621/c6e463bb/attachment.bin>


More information about the Strace-devel mailing list