[PATCH] netlink: add type decoding

Masatake YAMATO yamato at redhat.com
Thu Jun 8 09:05:51 UTC 2017


>> 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?

As we did in socketutils.c, we can get the information
for decoding from kernel via netlink.

Masatake YAMATO




More information about the Strace-devel mailing list