Hi Lukas,

On Fri, Apr 11, 2014 at 02:43:47PM +0200, Lukas Tribus wrote:
> Hi,
> 
> 
> > On Fri, Apr 11, 2014 at 02:09:09PM +0200, Nenad Merdanovic wrote:
> >> Why are we using gethostbyname() first if USE_GETADDRINFO is enabled?
> >
> > Probably only because that's what we used to do for over a decade in fact.
> > Getaddrinfo() used to work very badly on a large number of platforms,
> > leading us to use a #ifdef on it. That might have lead to a lack of trust
> > of this function over time.
> 
> 
> FYI, with getaddrinfo() - with Nenad's patch - against a dual-stacked host
> and without IPv6 connectivity leads to additional syscalls in this case:
> 
> connect(4, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, 
> "2a03:2880:f010:900:face:b00c:0:1", &sin6_addr), sin6_flowinfo=0, 
> sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable)
> connect(4, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) 
> = 0
> connect(4, {sa_family=AF_INET, sin_port=htons(0), 
> sin_addr=inet_addr("31.13.81.144")}, 16) = 0

Wow! definitely not acceptable! How does this happen BTW if the address
is resolved only once ?

> Also we need to be aware that browsers do a lot of tricks to fix IPv6
> blackholes (RFC6555), while we don't.
> 
> By using this approach we switch from default IPv4 to default IPv6.

Yes and that was clearly not my intent.

> I agree that this makes sense and needs to be done, I'm just raising
> awareness of the problems we may see when starting to do so.

Thanks for raising it. Maybe we should use another method instead then.
First, if "ipv6@" or "ipv4@" do not always work, we need to fix that.
Second, we could have an explicit "inet@" to mean "use IPv4 or IPv6,
I don't care".

The config should always lead to "the right thing" and what the user
expects. I definitely do not expect my system to randomly use whatever
version it supports in a dual stack mode.

The behaviour should be clearly defined and the user must be able to
force it even if that involves getting a config-time error because no
address is known for the requested address class.

Regards,
Willy


Reply via email to