X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Fsocket-util.c;h=4c1869353f31ff9d9e4f97ee92c2668105e5e27b;hp=d8006e66ebb38ea1fac1f03b8f399156f1131998;hb=a683e1878913969ccf8b0defdec4d955e15ed75a;hpb=bec293e4bf293b14c95ee93e2f342571d53c5162 diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index d8006e66e..4c1869353 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -1066,3 +1066,22 @@ struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t leng return NULL; } + +#if 0 /// UNNEEDED by elogind +int socket_ioctl_fd(void) { + int fd; + + /* Create a socket to invoke the various network interface ioctl()s on. Traditionally only AF_INET was good for + * that. Since kernel 4.6 AF_NETLINK works for this too. We first try to use AF_INET hence, but if that's not + * available (for example, because it is made unavailable via SECCOMP or such), we'll fall back to the more + * generic AF_NETLINK. */ + + fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0); + if (fd < 0) + fd = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_GENERIC); + if (fd < 0) + return -errno; + + return fd; +} +#endif // 0