[PATCH] Linux: Implement opensock using Netlink sockets

Florian Weimer fw@deneb.enyo.de
Mon Jun 18 17:13:00 GMT 2018


* Ben Hutchings:

> On Mon, 2018-06-18 at 12:50 +0200, Florian Weimer wrote:
>> inet/tst-inet6_scopeid_pton uses __opensock indirectly, to call ioctl
>> with SIOCGIFINDEX, and it still works after this change.
>> 
>> 2018-06-18  Florian Weimer  <fweimer@redhat.com>
>> 
>> 	* sysdeps/unix/sysv/linux/opensock.c (__opensock): Unconditionally
>> 	return a Netlink socket.
>> 	* sysdeps/unix/sysv/linux/s390/opensock.c: Remove file.
> [...]
>
> I agree that we can assume the kernel implements AF_NETLINK, but the
> available socket address families might be restricted by a security
> policy (e.g. systemd's RestrictAddressFamilies property).  I'm not sure
> whether it's safe to assume that they will always allow AF_NETLINK.

If it actually worked, the AF_NETLINK approach seems cleaner in this
regard.  The current code goes hunting for information in /proc (to
avoid loading unwanted kernel modules), which requires a much larger
footprint and is harder to filter.



More information about the Libc-alpha mailing list