[Patch v2 2/2] idiag: add a copy of linux/tcp.h

Thomas Graf tgraf at suug.ch
Fri Nov 7 03:28:57 PST 2014


On 11/07/14 at 11:25am, Thomas Graf wrote:
> On 10/27/14 at 09:50am, Cong Wang wrote:
> > Similarly, there are some fields in struct tcp_info
> > which are not available on older kenrels.
> > 
> > Note, now libnl could return a larger tcp_info if it runs
> > on an older kernel, but it should be fine as long as we
> > don't return smaller.
> 
> That only works as long as the libnl header copy is more or
> equally recent as the installed tcp_info definition. Otherwise
> behaviour is mostly undefined.
> 
> We need to come up with something that is more stable.

I agree to this patch if the behaviour is properly documented as in
explaining that parts might stay uninitialized. It's already broken
like that and we can't fix it for existing callers.

We should provide a new API though which takes a pointer to a tcp_info
plus length, initializes it properly and copies what is available.

The new API should be referred to in the doc of the old API.



More information about the libnl mailing list