[Swan-dev] libswan/ttoaddress.c: use getaddrinfo(3) instead of gethostbyname2(3)

Andrew Cagney andrew.cagney at gmail.com
Mon May 3 19:01:49 UTC 2021

On Mon, 3 May 2021 at 13:54, D. Hugh Redelmeier <hugh at vault.libreswan.fi>

> New commits:
> commit 379929c054bbe6022abbc456f5c1fd9bd453470d
> Author: D. Hugh Redelmeier <hugh at mimosa.com>
> Date:   Mon May 3 12:37:40 2021 -0400
>     libswan/ttoaddress.c: use getaddrinfo(3) instead of gethostbyname2(3)
>     Modernization.  Much simplification.
>     I'm not sure if we lose support for hex representation of IP
>     addresses.  Unit tests still pass.
>     I'm not sure if what happens when putitive domain names contain bad
>     characters.  Unit tests still pass.
>     We always accept the first result from getaddrinfo(3).  This may
>     change prioritization of IPv4 vs IPv6, but at least it matches RFC
>     3484 (according to the man page).

I'm not sure how much we want to trust getaddrinfo() to Do_The_Right_Thing

For instance, given a choice between IPv4 and IPv6 which will it return
first?  The documentation I'm reading states:
     By default IPv6 address entries are ordered before IPv4 ones, but the
     order of the entries in the list can be controlled using ip6addrctl(8).
yet Pluto, at least for now, wants IPv4 to trump IPv6.  This so that
existing configs don't magically switch protocols and wanders into into the
suspect IPv6 tunneling IPv4 code path.

(my best guess at RFC 3484 is that it should prefer IPv4 because
::ffff:N.N.N.N will sort earlier, but I'm guessing and no documentation for
getaddrinfo() even hits at it complying with that RFC?)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libreswan.org/pipermail/swan-dev/attachments/20210503/4fa396ba/attachment-0001.html>

More information about the Swan-dev mailing list