|
Message-ID: <3b4d958a-f00e-564a-7715-c92d7592ce3f@greenwavesystems.com>
Date: Wed, 4 Dec 2019 18:44:29 -0800
From: Bob Richmond <robert.richmond@...enwavesystems.com>
To: musl@...ts.openwall.com
Subject: getaddrinfo/AI_ADDRCONFIG with ipv6 disabled
connect() to the IPv6 loopback address can fail with EACCES on Linux if
IPv6 is disabled on the lo interface, and causes getaddrinfo to fail
without returning IPv4 addresses. It should be treated as if IPv6 is
disabled.
echo 1 >/proc/sys/net/ipv6/conf/lo/disable_ipv6
struct addrinfo hints, *res = NULL;
hints.ai_family = PF_UNSPEC;
hints.ai_flags = AI_ADDRCONFIG;
getaddrinfo("192.168.1.1", "80", &hints, &res);
strace:
======start=======
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_UDP) = 14
connect(14, {sa_family=AF_INET, sin_port=htons(65535),
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
close(14) = 0
socket(AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_UDP) = 14
connect(14, {sa_family=AF_INET6, sin6_port=htons(65535),
inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=htonl(0),
sin6_scope_id=0}, 28) = -1 EACCES (Permission denied)
close(14) = 0
writev(2, [{iov_base="[warn] getaddrinfo: Permission denied\n",
iov_len=38}, {iov_base=NULL, iov_len=0}], 2) = 38
======end=========
View attachment "musl-getaddrinfo-ipv6-eacces.patch" of type "text/x-patch" (305 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.