From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 271DD38582A4 for ; Wed, 14 Sep 2022 22:34:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 271DD38582A4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663194852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yOFrhaRhV11u6DPklNG6Sr7tjCjyYljuGAcFhA9w8Wo=; b=L3+hFSgwb/RBQyDcpQeXg9Zi5SR9trG7kW33qiCG0ndfoR+fIFEQQT9YwuB/7vUGZR3BIk KvSMyQ/A2DXamfJ5Lrd6YSXDHydP9JigRX7M9nxZi/fDWcuhl9xQ2d1cgqC/e0yRxudGja PnoYYWD/TZKqebIPIepGLquRbkx0Gzo= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-227-qtVbHjbqP2SPIlkKbB8-qQ-1; Wed, 14 Sep 2022 18:34:11 -0400 X-MC-Unique: qtVbHjbqP2SPIlkKbB8-qQ-1 Received: by mail-ed1-f72.google.com with SMTP id i17-20020a05640242d100b0044f18a5379aso11892314edc.21 for ; Wed, 14 Sep 2022 15:34:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=yOFrhaRhV11u6DPklNG6Sr7tjCjyYljuGAcFhA9w8Wo=; b=hFVBNmofn2lBpyMKFXZ4bb4bcijpznvTPMS5YR+qjwKBU4Jb9a3Q+Cw7/fI9F5T1Aj FIexoTHRX0rc9ycvL1SDTsAsfflmOMYSbOtSmX3/QAACByKpds4N9cYaOaTn2AxzKNMR s/IJNp0ZNZtvL9wrU43Scqzyzak8Mx0tfrd/chvWlX7c6/HEEL6crwGHdhSytV02S/7P TgyHJk8hz4otFXS8BwDG3HBkKCgeuxx0BLVyOf1fEgPZhZfLRxCMPxXj0hKiTjoOPjwb E6gyWhPFLSUxiltxyqDCEYDuDPLf9ksPl2fEQmYx0JSsBazRWxJo54IM1SUW00MtvQH5 QPGQ== X-Gm-Message-State: ACgBeo00nzG3g188D9uosmtd6QY3Dsv+pnMLxPsZxQFqG0rzTdSXrSsN ZHelS/ziRaOWaaYrZsTXXaHKoV+yF4LSUJdrlBdqgqEFb1Iu6IDI0jyq8Or9AM3Ieo8B4z70lXB EoP6UZKP1tdMJiRYQTWZ3 X-Received: by 2002:a05:6402:5cd:b0:446:5965:f4af with SMTP id n13-20020a05640205cd00b004465965f4afmr32224827edx.12.1663194850128; Wed, 14 Sep 2022 15:34:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ukkWjL7gfnovvZE7Fa1i9UL7Wiee8muCWArXuxR9WnMEUNzBTgpFrKrBG7vDoH4yodyBI7g== X-Received: by 2002:a05:6402:5cd:b0:446:5965:f4af with SMTP id n13-20020a05640205cd00b004465965f4afmr32224818edx.12.1663194849972; Wed, 14 Sep 2022 15:34:09 -0700 (PDT) Received: from fedora ([62.209.192.211]) by smtp.gmail.com with ESMTPSA id p1-20020a056402044100b0044e81203bebsm10443138edw.31.2022.09.14.15.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 15:34:09 -0700 (PDT) Date: Wed, 14 Sep 2022 18:34:07 -0400 From: Carlos O'Donell To: Florian Weimer Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 1/2] nss: Implement --no-addrconfig option for getent Message-ID: References: <462265b0ce37bd57b9304d873e9bccdb1cc4a199.1663079342.git.fweimer@redhat.com> MIME-Version: 1.0 In-Reply-To: <462265b0ce37bd57b9304d873e9bccdb1cc4a199.1663079342.git.fweimer@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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: On Tue, Sep 13, 2022 at 04:35:44PM +0200, Florian Weimer via Libc-alpha wrote: > The ahosts, ahostsv4, ahostsv6 commands unconditionally pass > AI_ADDRCONFIG to getaddrinfo, which is not always desired. Looking forward to a v2. > --- > NEWS | 5 ++++- > nss/getent.c | 11 ++++++++++- > 2 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/NEWS b/NEWS > index ef274d1a42..d4739d93c6 100644 > --- a/NEWS > +++ b/NEWS > @@ -9,7 +9,10 @@ Version 2.37 > > Major new features: > > - [Add new features here] Suggest: * The getent tool now supports the --no-addrconfig option. The output of getent with --no-addrconfig may contain addresses of families not configured on the current host i.e. as-if you had not passed AI_ADDRCONFIG to getaddrinfo calls. This flag is primarily intended for diagnostic purposes. I think the use for diagnostics should be called out. > +* The getent tool now supports the --no-addrconfig option. When > + present, getent no longer passes AI_ADDRCONFIG to the getaddrinfo > + function, and the output may contain addresses of families not > + configured on the current host. > > Deprecated and removed features, and other changes affecting compatibility: > > diff --git a/nss/getent.c b/nss/getent.c > index 8178b4b470..39a42e707d 100644 > --- a/nss/getent.c > +++ b/nss/getent.c > @@ -58,6 +58,8 @@ static const struct argp_option args_options[] = > { > { "service", 's', N_("CONFIG"), 0, N_("Service configuration to be used") }, > { "no-idn", 'i', NULL, 0, N_("disable IDN encoding") }, > + { "no-addrconfig", 'A', NULL, 0, > + N_("disable AI_ADDRCONFIG (for ahosts*)") }, Suggest a more user-center textual description: "disable filtering using host address configuration (for ahosts*)" It's a bit of a mouthfull. > { NULL, 0, NULL, 0, NULL }, > }; > > @@ -79,6 +81,9 @@ static struct argp argp = > /* Additional getaddrinfo flags for IDN encoding. */ > static int idn_flags = AI_IDN | AI_CANONIDN; > > +/* Set to 0 by --no-addrconfig. */ > +static int addrconfig_flags = AI_ADDRCONFIG; > + OK. > /* Print the version information. */ > static void > print_version (FILE *stream, struct argp_state *state) > @@ -346,7 +351,7 @@ ahosts_keys_int (int af, int xflags, int number, char *key[]) > > struct addrinfo hint; > memset (&hint, '\0', sizeof (hint)); > - hint.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME > + hint.ai_flags = (AI_V4MAPPED | addrconfig_flags | AI_CANONNAME > | idn_flags | xflags); OK. > hint.ai_family = af; > > @@ -905,6 +910,10 @@ parse_option (int key, char *arg, struct argp_state *state) > idn_flags = 0; > break; > > + case 'A': > + addrconfig_flags = 0; > + break; OK. > + > default: > return ARGP_ERR_UNKNOWN; > } > -- > 2.37.2 > >