Index | Thread | Search

From:
Florian Obser <florian@openbsd.org>
Subject:
Re: netstat(1): get rid of inet_aton
To:
tech@openbsd.org
Date:
Mon, 12 Aug 2024 08:32:48 +0200

Download raw body.

Thread
On 2024-08-12 00:07 +02, Kirill A. Korinsky <kirill@korins.ky> wrote:
>
> The current code handles the case where localhost is 127.0.0.2 and
> /etc/hosts has relevant records.

not since rev 1.60 of lib/libc/asr/getaddrinfo_async.c

>
> As far as I can see in RFC 1122 and 6890, any address from 127.0.0.0/8 can
> be used as a loopback.
>
> Am I missing the place where 127.0.0.1 is required to be the only possible
> localhost address?
>

The commit message quotes this:

    RFC 6761, 6.3 Domain Name Reservation Considerations for "localhost.":
       3.  Name resolution APIs and libraries SHOULD recognize localhost
           names as special and SHOULD always return the IP loopback address
           for address queries and negative responses for all other query
           types.  Name resolution APIs SHOULD NOT send queries for
           localhost names to their configured caching DNS server(s).

Now, you could hagle a bit what "the IP loopback address" actually
means. On OpenBSD it means 127.0.0.1 for IPv4 and ::1 for IPv6.

> -- 
> wbr, Kirill
>

-- 
In my defence, I have been left unsupervised.