Subject: Re: [RFC PATCH net-next 0/9] netlink: strict attribute checking option

From: David Ahern <[email-masked]>
Date: Fri, 16 Oct 2015 09:57:33 -0600

On 10/16/15 2:02 AM, Jiri Benc wrote:
> On Fri, 16 Oct 2015 01:06:44 -0700 (PDT), David Miller wrote:
>> No, it's definitely not OK, because lwtunnel support exists in
>> Linus's tree.
>>
>> And tools should be able to work on all kernels where lwtunnel support
>> is available.
>
> You can consider the lwtunnels feature as not finished in the current
> Linus's tree. It works, it won't change (thus anything using it in its
> current form will continue to work in all the future kernels), but
> mainstream tools won't make use of it until a kernel version later
> which will get some additional support.
>
> I don't think it's much of a problem and I don't think it is the first
> time this would happen.
>
> I'm afraid I don't have any solution that could do better.

What about a flag that requests the version from the relevant kernel 
subsystem?

Generate the same initial netlink message -- e.g., type set to 
RTM_NEWROUTE for example -- but with no attributes and the NLM_F_VERSION 
flag set. Send the message using whatever socket protocol is relevant 
for the command/query.

Then kernel side the message makes its way to the relevant handler, the 
handler sees the flag asking for version and responds with its version. 
The version would be local to the handler and is a means for telling 
userspace what attributes it understands.