Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 2461A1A3BCAE for ; Wed, 29 Feb 2012 12:03:11 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S2lzg-0006q8-Pw for pgsql-bugs@postgresql.org; Wed, 29 Feb 2012 16:03:10 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q1TG2u3V001444; Wed, 29 Feb 2012 11:02:56 -0500 (EST) To: Curd Reinert cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6494: Listening to * fails for IP V6 In-reply-to: References: Comments: In-reply-to Curd Reinert message dated "Wed, 29 Feb 2012 10:57:56 +0100" Date: Wed, 29 Feb 2012 11:02:56 -0500 Message-ID: <1443.1330531376@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201202/209 X-Sequence-Number: 32552 Curd Reinert 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