#1007258 apt-cacher-ng: VPN IPv6 address in /etc/hosts causes error when WiFi interface is IPv4-only

Package:
apt-cacher-ng
Source:
apt-cacher-ng
Description:
caching proxy server for software repositories
Submitter:
Sean Whitton
Date:
2022-03-14 22:54:04 UTC
Severity:
normal
Tags:
#1007258#5
Date:
2022-03-14 22:48:10 UTC
From:
To:
Dear maintainer,

I have a stock apt-cacher-ng on my laptop.  Apt's Acquire::HTTP::Proxy
is set to "http://[::1]:3142".  I have an ordinary apt source configured
for <http://silentflame.com/debian>.  In my /etc/hosts I have a line
like this:

    fdff:9895:c0d0:1::3	silentflame.com www.silentflame.com [...]

That IPv6 address is the VPN address of the web server serving
silentflame.com.  The VPN is IPv6-only.  So, it is possible to reach the
web server via IPv6 on the VPN, or via IPv4 or IPv6 via the public
Internet.

What I expect to happen is that apt-cacher-ng obtains files from
silentflame.com via the VPN, using IPv6.  However, this works only if
my primary network interface, wlp0s20f3, has an IPv6 address.  When
wlp0s20f3 has only an IPv4 address, I get errors like this:

    spwhitton@melete:~>sudo apt-get update
    Err:1 http://silentflame.com/debian bullseye InRelease
      503  DNS error - system error [IP: ::1 3142]

'curl http://silentflame.com/debian/dists/bullseye/InRelease' can
successfully retrieve files over HTTP over the VPN, regardless of what
addresses wlp0s20f3 has, as you would expect.

A work around is to add a public Internet IPv4 entry for silentflame.com
to /etc/hosts:

    188.34.164.90 silentflame.com

But that shouldn't be necessary, right?

Thanks.