[PATCH 04 of 10 ipv6 V2] tinyproxy: use IPv6 if HGIPV6 is set to 1

David Soria Parra dsp at experimentalworks.net
Tue Feb 21 12:29:50 EST 2017


On Mon, Feb 20, 2017 at 07:03:36PM -0800, Jun Wu wrote:
> 
> Thanks for pointing out the RFC.
> 
> The V1 series was ipv6 by default. But buildbot was not happy with all
> changes. In order to make all changesets green, I have to temporarily
> disable V6 handling, therefore V2 and IPv4 by default.
> 
> Since the changes were committed, we could change it to V6 by default now.
> Maybe add a flag like --netaddr-family=auto|ipv6|ipv4
 
That would be an okay idea

> > In order to obtain the available localhost addresses we should use
> > socket.getaddrinfo() to obtain a list of available v4/v6 addresses and
> > bind on both. This should be doable without using HGIPV6 in tinyproxy
 
> As long as "hg serve" sticks to one address family, I don't think it's
> useful to make tinyproxy bind on both.

> "HGIPV6" is a way to provide hgrc's "web.ipv6" for non-hgrc-aware programs.
> So if you'd like to remove "HGIPV6", maybe try remove "web.ipv6" first.
> 
> > and dumbhttp. We can use this list to glob() 127.0.0.1 correctly, even in the
> > case of FreeBSD jails and don't rely on hardcoded ::1/127.0.0.1 addresses. This
> 
> This looks like a separate issue. Note that "getaddrinfo()" just reads
> "/etc/hosts", instead of the real interfaces. The list returned by
> "getaddrinfo()" cannot be trusted, if we want real interface info.

You are right. In this case it should be determining LOCALIP:
1. try to use getaddrinfo() of localhost
2. if unavailable, use ::1/127.0.0.1 loopback
3. otherwise abort

> > should allow us to use IPv6 on a test host correctly when avaialble and fallback
> > to IPv4 graciously. I see why we want to introduce switches in tests for v4/v6
> > only, but I feel that the current implementation does not correctly test default
> > addr selection (which might be part of causing the flakeyness).
> 
> Previously, there is no IPv6 support at all. The system has to have a
> working IPv4 configuration to run tests. And the port check logic only
> checked "localhost", which is simply wrong since "hg serve" binds on all
> interfaces.
> 
> So in weird situations, the tests will just fail, like:
> 
>   - All network interfaces (incl. "lo") do not have IPv4 addresses.
>   - The "localhost" hostname does not resolve to an IPv4 address.
>   - The port being used by "hg serve" is free on "lo", but not all
>     interfaces.
>
> My patches should have made tests just work instead of failing, in the above
> situations.

I think my point is that the correct thing to do, is to bind on v6/v4 if
available at all times (that includes hg serve, i look into this) instead
of make it a switch, as that would defeat the address resolution rfc.


More information about the Mercurial-devel mailing list