[PATCH] netlink: add type decoding

Dmitry V. Levin ldv at altlinux.org
Tue Jun 6 20:48:21 UTC 2017


On Tue, Jun 06, 2017 at 01:09:21PM +0900, Masatake YAMATO wrote:
> On Mon, 5 Jun 2pp017 19:53:00 +0300, Dmitry V. Levin wrote:
> > On Mon, Jun 05, 2017 at 03:07:04PM +0800, JingPiao Chen wrote:
> >> On Sun, Jun 04, 2017 at 10:40:09PM +0300, Dmitry V. Levin wrote:
> > [...]
> >> > getfdnlproto (get_fd_nl_family in my edition) is not cheap
> >> > (it invokes syscalls), needless calls should be avoided.
> >> 
> >> I have read your code, I will rebase my code after you merge
> >> ldv/netlink branch.
> > 
> > The first portion of netlink commits is merged now,
> > it's time to rebase.  Thanks!
> 
> JingPiao, great work! I have really wanted this.
> 
> Do you have a plan to work on decoding NETLINK_GENERIC?

I think the nearest plan is to decode other netlink families.

> I'm interested in the area. If you don't have a plan,
> I would like to finish the following stub.

Feel free to finish it if you like. :)

> Masatake YAMATO
> 
> diff --git a/netlink.c b/netlink.c
> index f9ff465..215807a 100644
> --- a/netlink.c
> +++ b/netlink.c
> @@ -110,6 +110,26 @@ static const struct {
>  	[NETLINK_XFRM] = { nl_xfrm_types, "XFRM_MSG_???" }
>  };
>  
> +static struct xlat *build_genl_types_cache(void)
> +{
> +	static bool tried_once;
> +	if (tried_once)
> +		return NULL;
> +	tried_once = true;
> +
> +	/* STUB: This must be built dynamically. */
> +	static struct xlat dummy [] = {
> +		{
> +			0x0010, "nlctrl",
> +		},
> +		{
> +			0x0019, "tcp_metrics",
> +		},
> +		XLAT_END
> +	};

How can you build this dynamically?


-- 
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/20170606/55595a53/attachment.bin>


More information about the Strace-devel mailing list