AF_INET assumes that IPv4 is built into the kernel, but it's completely
valid to build a kernel without it. unix(4) sockets, on the other hand,
are not-optional in the kernel build. Given that interface ioctls can
be invoked on any kind of socket, switch to the safer one to avoid
breaking on IPv6-only kernels.
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
{
static int sock = -1;
if (sock < 0)
- sock = socket(AF_INET, SOCK_DGRAM, 0);
+ sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
return sock;
}