From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cygnus.enyo.de (cygnus.enyo.de [79.140.189.114]) by sourceware.org (Postfix) with ESMTPS id 6376C3858C20 for ; Sun, 5 Nov 2023 20:10:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6376C3858C20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=deneb.enyo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=deneb.enyo.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6376C3858C20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=79.140.189.114 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699215054; cv=none; b=N095NWUipJdYKWJdCx1BM3dynuWfLIK9oQFB1ebFOXTW+JI/OdyvRKZfEMxaehySgV2Yp+1Bt+GJwZwrpcmgiXgJljBoGU4A4e/ksn76GtpIQ8+5RCi23TZ386g1yGdEerr0Nm4aOR9qmvn81UaLl8WNA4HkobSO1k0NjOVnpn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699215054; c=relaxed/simple; bh=yad/XwkLclZh8eEScyeC0qemIs0yHLYkaQxQxiyIQoA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=RbmAQhcbaNz1rdkPvfkZ7pqgKCxj0RvNcm9umxOhpGFiUzOlg/VGfhKkHcLaxWao8zIAoMoa0s1gZ6b//pWEnrKkiEcGFiRmqgoUOGfLgT0z6rzKdfEIDU1uxqmofyTZEwS90nCEIYM1xy6gaqbsO1WfrrgCOCuVnNtfQzs8wFU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [172.17.203.2] (port=35489 helo=deneb.enyo.de) by albireo.enyo.de ([172.17.140.2]) with esmtps (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) id 1qzjSL-00H710-Mg; Sun, 05 Nov 2023 20:10:50 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.96) (envelope-from ) id 1qzjSM-000K6f-1w; Sun, 05 Nov 2023 21:10:50 +0100 From: Florian Weimer To: Glenn Golden Cc: libc-help@sourceware.org Subject: Re: getent ahostsv4 seems to interact with network interface addressing References: Date: Sun, 05 Nov 2023 21:10:50 +0100 In-Reply-To: (Glenn Golden's message of "Sat, 4 Nov 2023 07:23:56 -0600") Message-ID: <875y2ggdv9.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Glenn Golden: > System: > Arch linux, glibc 2.38-7, kernel 6.1.59-1, commodity i686 laptop. > > Description of issue: > Not sure if this is a bug or just a misunderstanding on my part as to how > getent ought to be behaving when attempting lookups using the ahostsv4 > database, expecting it to query and return results from /etc/hosts. > > The behavior of "getent ahostsv4 HOSTNAME" seems to strangely depend on > whether there are any network interfaces presently having an assigned v4 > address, as demonstrated in detail in "Steps to reproduce" below. By default, getent uses AI_ADDRCONFIG under the covers, and what you see is the expected behavior of that getaddrinfo option. Recent glibc versions have a getent option that switches of AI_ADDRCONFIG: -A, --no-addrconfig do not filter out unsupported IPv4/IPv6 addresses (with ahosts*)