This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Linux: Implement opensock using Netlink sockets
On 18/06/2018 14:09, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>>> Ahh, it's been fixed since then. Netlink sockets were one of the
>>> few which did not perform ENOIOCTLCMD fallback. This was changed in
>>> kernel 4.6:
>>>
>>> commit 025c68186e07afaededa84143f1a22f273cd3f67
>>> Author: David Decotigny <decot@googlers.com>
>>> Date: Mon Mar 21 10:15:35 2016 -0700
>>>
>>> netlink: add support for NIC driver ioctls
>>>
>>> By returning -ENOIOCTLCMD, sock_do_ioctl() falls back to calling
>>> dev_ioctl(), which provides support for NIC driver ioctls, which
>>> includes ethtool support. This is similar to the way ioctls are
>>> handled in udp.c or tcp.c.
>>>
>>> This removes the requirement that ethtool for example be tied to the
>>> support of a specific L3 protocol (ethtool uses an AF_INET socket
>>> today).
>>>
>>> It's unfortunate that it took that long to make this change.
>>>
>>> Thanks,
>>> Florian
>>
>> Indeed, so I think we will need the fallback options (maybe we can restrict
>> to some options).
>
> The real question is whether it is important to avoid module loading.
> If we could just try
>
> AF_NETLINK
> AF_UNIX
> AF_INET
> AF_INET6
>
> in this order, irrespective of the module load status, the code would
> already be much, much simpler.
>
I think it should cover the expected kernel support (it would be unusual to
use the getifaddr functions with a kernel without tcpip support).
The issues is we will need to ensure the returned socket works with
SIOCGIFNAME (maybe by issuing a ioctl to make it sure).