sd-device/networkd: unify code to get a socket for issuing netdev ioctls on

As suggested here:

https://github.com/systemd/systemd/pull/4296#issuecomment-251911349

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.
This commit is contained in:
Lennart Poettering
2016-10-06 19:04:01 +02:00
parent d21494ea25
commit 429b435026
4 changed files with 25 additions and 5 deletions
+2
View File
@@ -154,3 +154,5 @@ struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t leng
1 + strnlen(_sa->sun_path+1, sizeof(_sa->sun_path)-1) : \
strnlen(_sa->sun_path, sizeof(_sa->sun_path))); \
})
int socket_ioctl_fd(void);