From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26904 invoked from network); 30 Apr 2021 17:58:06 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 30 Apr 2021 17:58:06 -0000 Received: (qmail 18005 invoked by uid 550); 30 Apr 2021 17:58:03 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 17701 invoked from network); 30 Apr 2021 17:56:41 -0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.cipht.net; q=dns/txt; s=mailo; t=1619805404; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Cc: To: From: Sender; bh=49jfmiIOY/1YcBVYjhB5Tu3GqJouNIs4FOleUuhJZpI=; b=Gxu3/9fodInCabcrj+Xw6DBYkijfEB54tbzMm7A4axspqgoRDmdEI7D+RFUIzbuVIpKFluca fg6zOV7n2o85MMe3s/4nVlkrO8fTAnuxjuaw44yyz9+26gb0OVXyeGwML91yJGS10oZzN+x4 h227KTZU+9mnbYBMJZczjn1H66s= X-Mailgun-Sending-Ip: 69.72.42.7 X-Mailgun-Sid: WyIzZTJlZiIsICJtdXNsQGxpc3RzLm9wZW53YWxsLmNvbSIsICJkMWMxM2MiXQ== Sender: julian=cipht.net@mg.cipht.net From: Julian Squires To: musl@lists.openwall.com Cc: Julian Squires , Bob Richmond Date: Fri, 30 Apr 2021 15:26:13 -0230 Message-Id: <20210430175612.27804-1-julian@cipht.net> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH] handle linux-specific errors in getaddrinfo AI_ADDRCONFIG linux allows adding ip rules with actions such as RTN_PROHIBIT or RTN_BLACKHOLE to the loopback interface, e.g.: ip -6 rule add from all iif lo lookup unspec prohibit if the loopback interface also has ipv6 disabled: sysctl net/ipv6/conf/lo/disable_ipv6=1 the connect() in getaddrinfo will return EACCES or EINVAL, respectively, and getaddrinfo will erroneously return early. this may sound like a perverse misconfiguration, but it happens easily on openwrt systems where ipv6 has been disabled, as openwrt's netifd by default sets up these rules (with a custom RTN_POLICY_FAILED action, which behaves like RTN_PROHIBIT in this case). Signed-off-by: Julian Squires Co-authored-by: Bob Richmond --- src/network/getaddrinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c index efaab306..9a9c3cbc 100644 --- a/src/network/getaddrinfo.c +++ b/src/network/getaddrinfo.c @@ -76,6 +76,8 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru case EHOSTUNREACH: case ENETDOWN: case ENETUNREACH: + case EACCES: + case EINVAL: break; default: return EAI_SYSTEM; -- 2.31.1