units: systemd-udevd: add AF_INET to RestrictAddressFamilies=#4296
units: systemd-udevd: add AF_INET to RestrictAddressFamilies=#4296poettering merged 1 commit intosystemd:masterfrom
Conversation
|
I think the second paragraph of the following entry in NEWS needs to be removed or updated. |
/* Open control socket. */
ctx.fd = socket(AF_INET, SOCK_DGRAM, 0);
if (ctx.fd < 0)
ctx.fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (ctx.fd < 0) {
perror("Cannot get control socket");
return 70;
}Shouldn't we do the same? |
Well, this is a new feature: torvalds/linux@025c68186e07 |
|
So, we allow |
Yupp, I figure you are right: if we block AF_INET we should also block AF_INET6, and if we do not block either, we should not block the other either. They should always come in a pair I guess. @yuwata can you rework the patch to also unblock AF_INET6 hence? Also, please drop the NEWS blurb that's out-of-date now from the file, in the same commit. I think we should probably also implement the logic @evverx suggested (i.e. falling back to AF_NETLINK if AF_INET is not available for the interface ioctls everywhere). Even if it only works on new kernels for now I think it's in the long run the better choice. However, this change can be done later, as it doesn't fix anything... |
…lies= The udev builtin command `net_setup_link` requires AF_INET and AF_INET6. Fixes systemd#4293.
|
Force pushed updated version. Thank you. |
…tls on As suggested here: systemd#4296 (comment) Let's try AF_INET first as socket, but let's fall back to AF_NETLINK, so that we can use a protocol-independent socket here if possible. This has the benefit that our code will still work even if AF_INET/AF_INET6 is made available (for exmple via seccomp), at least on current kernels.
…tls on As suggested here: systemd#4296 (comment) Let's try AF_INET first as socket, but let's fall back to AF_NETLINK, so that we can use a protocol-independent socket here if possible. This has the benefit that our code will still work even if AF_INET/AF_INET6 is made available (for exmple via seccomp), at least on current kernels.
…tls on As suggested here: systemd#4296 (comment) Let's try AF_INET first as socket, but let's fall back to AF_NETLINK, so that we can use a protocol-independent socket here if possible. This has the benefit that our code will still work even if AF_INET/AF_INET6 is made unavailable (for exmple via seccomp), at least on current kernels.
The udev builtin command
net_setup_linkcallssocket(PF_INET, SOCK_DGRAM, 0) in ethtool-util.c.
So, the command requires AF_INET.
Fixes #4293.