Thread: Re: PostgreSQL 8.0.3 and Ipv6

Re: PostgreSQL 8.0.3 and Ipv6

From
Andrew Dunstan
Date:

[adding -hackers to discussion]


[getaddrinfo and friends are broken on some versions of windows]

Maggnus Hagander wrote:

>That definitly means it's broken. We need the same binary to run wether
>you have it or not - at least if we want it to be included in the
>precompiled binaries by the installer. That means we have to load the
>function with LoadLibrary / GetProcAddress, to check it at runtime.
>Yuck.
>
>  
>


Petr Jelinek wrote:

> Andrew Dunstan wrote:
>
>>
>> Yep. I don't think we have much choice. The upside is that we can 
>> let  the configure test stay as is and not worry about it further. 
>> Just put some ifdef''d code in src/port/getaddrinfo.c. Chuck McDevitt 
>> kindly said he will try next week to produce a patch.
>>
>
> I am glad Chuck took it because I wouldn't be able to do it in 
> reasonable time due to some probles in my real life.
>
> I am bit worried about those HAVE_IPV6 ifdefs - they will prolly have 
> to be modified to C code under windows
>

Now I consider it you might be right. Here's a list of those places:

[andrew@alphonso src]$ grep -rl HAVE_IP .
./include/pg_config.h.in
./include/libpq/ip.h
./include/pg_config.h
./bin/initdb/initdb.c
./Makefile.global.in
./backend/libpq/pqcomm.c
./backend/libpq/ip.c
./backend/libpq/hba.c
./backend/utils/adt/pgstatfuncs.c
./backend/utils/adt/network.c
./Makefile.global
./interfaces/libpq/ip.c
./port/getaddrinfo.c

Can we even get this done for 8.1, or is it too late? If it's too late 
we need to document heavily that we do not (fully) support IPv6 on 
Windows yet.

Can someone please try running a build from CVS tip made on a modern box 
(W2k3 or XP >= SP1 I believe) on a non-modern box (e.g. W2k) and see if 
anything blows up? If it does then we either have to finish this work 
now or revert the config file changes, I think.

cheers

andrew





Re: PostgreSQL 8.0.3 and Ipv6

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
>> I am bit worried about those HAVE_IPV6 ifdefs - they will prolly have 
>> to be modified to C code under windows

> Now I consider it you might be right. Here's a list of those places:
> [lots]

You should not have to touch the HAVE_IPV6 code --- if you think you
do, you're misunderstanding the problem.  The IPV6 code was designed
to work even if the local kernel does not understand IPV6 (of course
you don't actually get any IPV6 connectivity, but nothing breaks).
It should be possible to handle Windows the same way.

> Can we even get this done for 8.1, or is it too late?

Considering that this is a new feature that we didn't have in 8.0,
anything more than a very localized tweak is not going to be accepted
for 8.1.
        regards, tom lane


Re: PostgreSQL 8.0.3 and Ipv6

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> The one place that very slightly bothers me is the ::1 line in 
> pg_hba.conf.  The fact that it comes last in the default config is its 
> saving grace - it won't ever be reached by a passing connection. I think 
> at least, though, we should put a warning comment line in front of it, 

If you like, you can improve initdb to comment that line out if
getaddrinfo chokes on "::1", rather than believing HAVE_IPV6.
        regards, tom lane


Re: PostgreSQL 8.0.3 and Ipv6

From
Andrew Dunstan
Date:

Tom Lane wrote:

>Andrew Dunstan <andrew@dunslane.net> writes:
>  
>
>>>I am bit worried about those HAVE_IPV6 ifdefs - they will prolly have 
>>>to be modified to C code under windows
>>>      
>>>
>
>  
>
>>Now I consider it you might be right. Here's a list of those places:
>>[lots]
>>    
>>
>
>You should not have to touch the HAVE_IPV6 code --- if you think you
>do, you're misunderstanding the problem.  The IPV6 code was designed
>to work even if the local kernel does not understand IPV6 (of course
>you don't actually get any IPV6 connectivity, but nothing breaks).
>It should be possible to handle Windows the same way.
>  
>

Ok, looked at these more closely.

The one place that very slightly bothers me is the ::1 line in 
pg_hba.conf.  The fact that it comes last in the default config is its 
saving grace - it won't ever be reached by a passing connection. I think 
at least, though, we should put a warning comment line in front of it, 
to the effect that if they see 'LOG:  invalid IP address "::1"'  in the 
log or a connection message like 'FATAL:  missing or erroneous 
pg_hba.conf file' they probably need to comment the line out.

I agree that most of the others don't matter (most are there just for 
case branches for AF_INET6).

>  
>
>>Can we even get this done for 8.1, or is it too late?
>>    
>>
>
>Considering that this is a new feature that we didn't have in 8.0,
>anything more than a very localized tweak is not going to be accepted
>for 8.1.
>
>
>  
>

Apart from  pg_hba.conf.sample (if you agree with the above), it looks 
like just port/getaddrinfo.c will need tweaking.

cheers

andrew


Re: PostgreSQL 8.0.3 and Ipv6

From
Petr Jelinek
Date:
Andrew Dunstan wrote:
> Can someone please try running a build from CVS tip made on a modern box 
> (W2k3 or XP >= SP1 I believe) on a non-modern box (e.g. W2k) and see if 
> anything blows up? If it does then we either have to finish this work 
> now or revert the config file changes, I think.

W2k and XP SP1 tested, builds and passes make check (except rules but 
thats just different sorting of output in my locale and I always had 
this problem - wiech is after wieck because 'ch' is character after 'h' 
in my alphabet).

-- 
Regards
Petr Jelinek (PJMODOS)