Re: [DNSOP] Why would a v4 client send AAAA query?

Naveen Kottapalli <naveen.sarma@gmail.com> Thu, 29 August 2019 09:44 UTC

Return-Path: <naveen.sarma@gmail.com>
X-Original-To: dnsop@ietfa.amsl.com
Delivered-To: dnsop@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7DDA91200A4 for <dnsop@ietfa.amsl.com>; Thu, 29 Aug 2019 02:44:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.755
X-Spam-Level:
X-Spam-Status: No, score=-0.755 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, NORMAL_HTTP_TO_IP=0.001, NUMERIC_HTTP_ADDR=1.242, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PiIxC-LDVs3k for <dnsop@ietfa.amsl.com>; Thu, 29 Aug 2019 02:44:11 -0700 (PDT)
Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D3FF212002F for <dnsop@ietf.org>; Thu, 29 Aug 2019 02:44:10 -0700 (PDT)
Received: by mail-io1-xd42.google.com with SMTP id j4so5573626iog.11 for <dnsop@ietf.org>; Thu, 29 Aug 2019 02:44:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=OghvVzcF6lTy1R3RFUmDMMH7GRW4Razw/XaTN4omD8c=; b=BGsc6sXnLtxNwvTDukoU6uyMmxqibw5W7Mr+kPhii7/ycUXv/RyyC/ZAli6upS2p6Y SNqV7qr6pFm6aaYM+5LHXoKGzQBvZQrEpmmb5xaYodotSU37EczbS7YuRyeM+eBLmN7Q IAKtXhijuN7+eLjsFvxNTKgcAOddwYSRVWGQotBmZUF+/N2XfTGYRu/+IhZolkmFprn3 k++BF+CrQ4rrlNimK1mxALpEufh5EKIUbPUb1n9/2S5SuoFNmq54fbSSurshKYYecS80 diNGglALhgYacJG8Dn4UL99bnYKhWsTvTJTOD4DfKRMaKdMbJTDiwT5pP8aC/t/8oyBt aROw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=OghvVzcF6lTy1R3RFUmDMMH7GRW4Razw/XaTN4omD8c=; b=TWn0wvcgsNY9aZI6B7O4Xf0Yv7q8P56okHBsFT6O9jiAoa0rjPdlO+cxj6TauUyHyP sVRyn/NSYhhSCWK+RhGVwWRQh7aBY9zc+/GRfeZwknG6ey5ml7aGjSvLoYbmB6NIWNZq O2dSCR77tOLvMW58rdMGSsiHDgfaGjfKF5YTmm0wgYBM0wh7riwba03Wg7fX/hsGseTD yQO4f4jVqzN5eHe+c6VskJBu91GwJbFNb0rzhdYcJ8SBIkvoBDmJp9j0eV1LDTIYd1IA BnJT5XI3itA6pCnOpdJNBOtGw5RmUI393DPNSkDpWXytMCVdbyyfA0h9j6yUZEZnJjzJ opZg==
X-Gm-Message-State: APjAAAVBB/YwB/Ix9jgUYPJYSoDiP4FVMnpHgXPIcHFDnChWvQ683mP6 UrQ9k3EriexQd/zo8mX6UXARy3J/gb6mBCbUNK8naw==
X-Google-Smtp-Source: APXvYqy+U1M8mMj5SEPu2+3xtqN5ey819C/hWDOdiQq6tC3cI8zvv530HZaGMGtP9mIXmqge3ULwv+MGd2w9GBkRIZU=
X-Received: by 2002:a02:c999:: with SMTP id b25mr2278131jap.120.1567071849713; Thu, 29 Aug 2019 02:44:09 -0700 (PDT)
MIME-Version: 1.0
References: <CANFmOtkrB=Z6HNyJ7SFinMAHJEgOB=J0KQnKxYqy_7kPYPbumg@mail.gmail.com> <20190829063910.GB90696@straasha.imrryr.org>
In-Reply-To: <20190829063910.GB90696@straasha.imrryr.org>
From: Naveen Kottapalli <naveen.sarma@gmail.com>
Date: Thu, 29 Aug 2019 15:13:45 +0530
Message-ID: <CANFmOt=_DqDNziVQh=5bF7yC-6DwPFPMYTz7kud7EwjsEFdY5Q@mail.gmail.com>
To: dnsop@ietf.org
Content-Type: multipart/alternative; boundary="000000000000f0957105913e58fe"
Archived-At: <https://mailarchive.ietf.org/arch/msg/dnsop/1v1alYo9zRaJ4xRKDsDspJcTuB8>
Subject: Re: [DNSOP] Why would a v4 client send AAAA query?
X-BeenThere: dnsop@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IETF DNSOP WG mailing list <dnsop.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dnsop>, <mailto:dnsop-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dnsop/>
List-Post: <mailto:dnsop@ietf.org>
List-Help: <mailto:dnsop-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dnsop>, <mailto:dnsop-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Aug 2019 09:44:14 -0000

My query was about the behavior we observed on a gateway where a pure v4
subscriber (not dual-stack) has sent both A and AAAA query for the same
domain simultaneously.  Just wanted to know why would a pure v4 subscriber
which cannot use the resolved AAAA domain addresses is trying to resolve
the v6 addresses of the domain.

Yours,
Naveen.


On Thu, 29 Aug 2019 at 12:09, Viktor Dukhovni <ietf-dane@dukhovni.org>
wrote:

> On Wed, Aug 28, 2019 at 05:53:26AM +0530, Naveen Kottapalli wrote:
>
> > Can one of you tell why would a v4 client send AAAA query or a by client
> > send a A query when the resolved address cannot be used?
>
> One answer I did not see, but seems to me to be the most likely,
> is that the library interface used by the application to learn the
> peer's addresses asks for and returns all the v4 and v6 addresses,
> and then the application tries each address in turn, until one
> succeeds, the library is address-family agnostic.
>
> Often the address resolution is many layers down below the actual
> application code, e.g. in an HTTP request library that uses a
> connection pool, that, as needed, establishes connections in a
> generic way, by using getaddrinfo(3) with AF_UNSPEC as the address
> family.  The library code many layers down below the application
> code making an HTTP request, has no prior knowledge that on this
> particular system IPv6 may not be available.  It just tries the
> returned addresses in order until one works.
>
> My system has IPv6, but only via a GRE tunnel to Hurricane Electric
> (many thanks to HE for the pretty good free service) and IPv6
> performance is consequently not nearly as good as IPv4.  So I've
> configured my (FreeBSD) system to prefer IPv4:
>
>     $ cat /etc/ip6addrctl.conf
>     # Prefer IPv4
>     ::ffff:0.0.0.0/96                100     4
>     ...
>
>     $ grep -i addrctl /etc/rc.conf
>     ip6addrctl_enable="YES"
>     ip6addrctl_policy="AUTO"
>
> With that, getaddrinfo(3) returns the IPv4 addresses first, and I
> only use IPv6 when none of the IPv4 addresses work, or the application
> chooses to also use the IPv6 addresses (e.g. the DANE survey code
> checks the validity of the certificate chain at every address of
> each MX host).
>
> For example (python):
>
>     from socket import getaddrinfo, SOCK_STREAM
>     for ai in getaddrinfo('www.ietf.org', 'https', type=SOCK_STREAM):
>         print(ai)
>
> outputs:
>
>     (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '',
> ('104.20.1.85', 443))
>     (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '',
> ('104.20.0.85', 443))
>     (<AddressFamily.AF_INET6: 28>, <SocketKind.SOCK_STREAM: 1>, 6, '',
> ('2606:4700:10::6814:55', 443, 0, 0))
>     (<AddressFamily.AF_INET6: 28>, <SocketKind.SOCK_STREAM: 1>, 6, '',
> ('2606:4700:10::6814:155', 443, 0, 0))
>
> If I use python's HTTP client code to fetch content from:
>
>     https://www.ietf.org/...
>
> code similar to the above will look up both the IPv4 and IPv6
> addresses, and then, if all goes well, use just the first one to
> make an IPv4 TCP connection to www.ietf.org (port 443), perform a
> TLS handshake, ...
>
> So the AAAA lookup is only used for IPv6-only sites, but that's the
> cost of all the layering and abstraction of address order preference,
> ....  An efficient implementation of getaddrinfo() can do the A and
> AAAA lookups concurrently.
>
> --
>         Viktor.
>
> _______________________________________________
> DNSOP mailing list
> DNSOP@ietf.org
> https://www.ietf.org/mailman/listinfo/dnsop
>