BUG #6494: Listening to * fails for IP V6
The following bug has been logged on the website:
Bug reference: 6494
Logged by: Curd Reinert
Email address: curd.reinert@ppi.de
PostgreSQL version: 9.0.7
Operating system: AIX
Description:
Hello everyone,
on a AIX with IP V6 enabled, I try to listen on all interfaces
listen_addresses = '*'
and get
LOG: could not bind IPv6 socket: Der Socket-Name wird bereits verwendet.
HINT: Is another postmaster already running on port 5432? If not, wait a
few seconds and retry.
Of course I made sure there was nothing running on that port. I can then
connect to the database using 127.0.0.1, but not with ::1.
If instead I specify the IP addresses explictly,
listen_addresses = '127.0.0.1,fdeb:df42:ebda:0815:0:0:0:18,::1'
then there is no error and I can connect to all the addresses. 'localhost'
instead of '*' also works, but I want to connect remotely.
It's a 9.0.7 which was build on AIX 5.3 with readline, zlib and
thread-safety disabled. The machine I originally tried to run it is a AIX
6.1. Symptoms on the 5.3 are the same.
We only have this trouble on AIX. We are already connection succesfully
remotely over IP V6 to database running on Linux, Solaris, and Windows 7 (as
far as I know).
I didn't find anything useful in FAQ or TODO, I hope I didn't miss something
obvious.
Many thanks,
Curd
Hello again,
since we've had similar trouble without own server sockets, I had a deeper
look into this one.
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.
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?
Best regards,
Curd
Von: Curd Reinert/HH/PPI
An: Curd Reinert/HH/PPI@PPI
Datum: 27.02.2012 19:04
Betreff: Listening to * fails for IP V6
Hello everyone,
on a AIX with IP V6 enabled, I try to listen on all interfaces
listen_addresses = '*'
and get
LOG: could not bind IPv6 socket: Der Socket-Name wird bereits verwendet.
HINT: Is another postmaster already running on port 5432? If not, wait a
few seconds and retry.
Of course I made sure there was nothing running on that port. I can then
connect to the database using 127.0.0.1, but not with ::1.
If instead I specify the IP addresses explictly,
listen_addresses = '127.0.0.1,fdeb:df42:ebda:0815:0:0:0:18,::1'
then there is no error and I can connect to all the addresses. 'localhost'
instead of '*' also works, but I want to connect remotely.
It's a 9.0.7 which was build on AIX 5.3 with readline, zlib and
thread-safety disabled. The machine I originally tried to run it is a AIX
6.1. Symptoms on the 5.3 are the same.
We only have this trouble on AIX. We are already connection succesfully
remotely over IP V6 to database running on Linux, Solaris, and Windows 7
(as far as I know).
I didn't find anything useful in FAQ or TODO, I hope I didn't miss
something obvious.
Many thanks,
Curd
Import Notes
Reply to msg id not found: OF4D41BDCD.FBF104D0-ONC12579B1.006337FF-C12579B1.00633ED9@LocalDomainReference msg id not found: OF4D41BDCD.FBF104D0-ONC12579B1.006337FF-C12579B1.00633ED9@LocalDomain | Resolved by subject fallback
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-owner@postgresql.org schrieb am 29.02.2012 17:02:56:
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.
I agree. I will try to narrow it down to a simple example and send it to
IBM.
code uglification,
I agree with that one, too.
Can you work around this with a suitable setting of listen_addresses?
That is, explicitly specify the V6 and then V4 addresses there?
Not really. Postgres is runnning at our customers sites, we don't know how
there networks are configured, and we don't know if IP addresses may
change. All we could do is describe the problem as a known bug when using
AIX, IPV6 and postgres together and explain the workaround.
Many thanks,
Curd