Re: BUG #6494: Listening to * fails for IP V6 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #6494: Listening to * fails for IP V6
Date
Msg-id 1443.1330531376@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #6494: Listening to * fails for IP V6  (Curd Reinert <Curd.Reinert@ppi.de>)
Responses Re: BUG #6494: Listening to * fails for IP V6
List pgsql-bugs
Curd Reinert <Curd.Reinert@ppi.de> writes:
> The trouble is that under AIX, once you have bound an IP V4 socket to a
> port, it seems you can't bind a IP V6 socket to the same port. The other
> way round works. And AIX seems to return addrinfo with IP V4 addresses in
> front.

Seems like that is a bug to file with IBM.

> What I did is that I doubled the loop in pqcomm.c. In the first run, I
> only consider IP V6. In the second, I tried the rest. This worked, and I
> was able to connect to the IP V4 and the IP V6 address.

> Since it doesn't harm with other OSes to bind IP V6 first, does it seem to
> you like a sensible way of fixing this?

No.  Aside from the code uglification, it seems to me that trying
addresses in an order different from the way that getaddrinfo returns
them is very likely to expose other corner-case misbehaviors in other
operating systems.

Can you work around this with a suitable setting of listen_addresses?
That is, explicitly specify the V6 and then V4 addresses there?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #6489: Alter table with composite type/table
Next
From: Tom Lane
Date:
Subject: Re: BUG #6497: Error sent to client, but data written anyway