Re: BUG #6494: Listening to * fails for IP V6

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Curd Reinert <Curd(dot)Reinert(at)ppi(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6494: Listening to * fails for IP V6
Date: 2012-02-29 16:02:56
Message-ID: 1443.1330531376@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Curd Reinert <Curd(dot)Reinert(at)ppi(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ryan Lowe 2012-02-29 17:26:13 Re: BUG #6497: Error sent to client, but data written anyway
Previous Message Alvaro Herrera 2012-02-29 14:40:31 Re: BUG #6489: Alter table with composite type/table