From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13000 Path: news.gmane.org!.POSTED!not-for-mail From: Christopher Friedt Newsgroups: gmane.linux.lib.musl.general Subject: getaddrinfo(3) / AI_ADDRCONFIG Date: Mon, 9 Jul 2018 11:16:04 -0400 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1531149265 24696 195.159.176.226 (9 Jul 2018 15:14:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 9 Jul 2018 15:14:25 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-13016-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jul 09 17:14:21 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fcXro-0006JW-If for gllmg-musl@m.gmane.org; Mon, 09 Jul 2018 17:14:20 +0200 Original-Received: (qmail 30532 invoked by uid 550); 9 Jul 2018 15:16:28 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 30498 invoked from network); 9 Jul 2018 15:16:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=LUx1AkIjqoTQ6FAMX+IW2ZhhwWZp6FC35GWQX3Xn/jc=; b=RyYgmnZZuCFuD7IkKSMQESG2VF/Jm0Tgsgma5fVfSVypsmwPFu8ESwHlsnTGKqnRV8 U7F8x0ST1Ii59LxOfvSfQmYanbpcmlQw+JFn/ejhmSwmLuXm1teo7rOLP1XOpQ2L/28Q QWzsNFlQoLmJUxb+IgWfHRR4mGdmCtl3ZRzU+t9I0Lrc8Q1k9SZ0x/5JdDKTEbS/r5Yb PFlxwDofoVZh9x7lnC0ko1e4GpEKKX+4iwoeeuygaMstj8Wl/jTAeo+gSwQGKURWClU8 vJcMTohpmDa++XbmAltr4aeidFgx2saQy0xZk0PgJA8MlttWwD3U8BkUQc8O5e6c7fw0 tudw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=LUx1AkIjqoTQ6FAMX+IW2ZhhwWZp6FC35GWQX3Xn/jc=; b=NPUpFNXP0t3de+UppEALbJesmvnIKI8QaRfR8unVLE2NNwWeBt1xrT6I9RHmWTDMh/ YEMWinrvMl7jgu/bo7j+7BUb+x4GvIh6ra5WX/fgy/gmfnL6D2pNjSp7nsEogPLUi/Hq 0ttY0LET/eyQeZBzPQRIO0Ex5ZcQPo+cRnGxzppn3JOviLBq6U4qzQmH2mUppz8WASUU wEZkgu4Tn9jDfTConL5BXWnnYK6+YRWdUXfXxmSgL1krsEpTz5h196OMaGx94XOuyofM WOx0gEQAl5m04YukiFEn7QRE/9SCrWdWGeIJ5kf6WBCkh8ToVMzXOVYBFVO9+c/1J2GE 1itQ== X-Gm-Message-State: APt69E0G8PwR6x3IF/K7ZPTjlTcr49sVtdcQzFbZOsj88avhGLur/kAG V1IjnDO+gy0RDV4K27pt8MxIX077LqkALzqKoZUIAQrt X-Google-Smtp-Source: AAOMgpe1j12h51zV2ojIYBqkvH+i0B7lVLeD9yWQxcqWIq2XskiPkP+Y2lhZOMRXOThgXs2i3HpctniqFiwOc7S8apw= X-Received: by 2002:aca:af15:: with SMTP id y21-v6mr24816624oie.324.1531149375860; Mon, 09 Jul 2018 08:16:15 -0700 (PDT) Xref: news.gmane.org gmane.linux.lib.musl.general:13000 Archived-At: Hi list, I have a patch for getaddrinfo(3) so that AI_ADDRCONFIG is properly supported. Currently, if user code passes in the aforementioned flag, there is no check to see whether a non-loopback network interface is configured with the specified (or unspecified) address family before returning results, which is what getaddrinfo(3) should do according to [1]. As a result of the current behaviour, musl's getaddrinfo(3) would return e.g. "::1" to user code even when no interfaces (including lo) were configured with IPv6 addresses. I've documented this to some extent here [2]. Please see the patch at [3] for my fix. Any feedback is welcome. The patch It applies against master and 1.1.19, but possibly other releases. C [1] http://man7.org/linux/man-pages/man3/getaddrinfo.3.html [2] https://issues.apache.org/jira/browse/THRIFT-4594 [3] https://patch-diff.githubusercontent.com/raw/cfriedt/musl/pull/1 https://patch-diff.githubusercontent.com/raw/cfriedt/musl/pull/1.diff