Re: IPV4 addresses on IPV6 machines in pg_hba.conf - Mailing list pgsql-patches

From Andreas Pflug
Subject Re: IPV4 addresses on IPV6 machines in pg_hba.conf
Date
Msg-id 3F59041C.1000709@pse-consulting.de
Whole thread Raw
In response to Re: IPV4 addresses on IPV6 machines in pg_hba.conf  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: IPV4 addresses on IPV6 machines in pg_hba.conf  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:

>I thought this was still really messy, so I modified it to use a
>separate "promote v4 address to v6" subroutine.  I've applied the
>attached patch (plus docs).  It's not very well tested since I don't
>have an IPv6 setup here; please check that it does what you want.
>
It SEGVs. Reason is that the memcpy of the promote_v4_to_v6_XXX
functions assumes that the sockaddr_storage is large enough to hold an
IPV6 address, which appears to be not true. Since the struct isn't
created by a plain malloc() and returned by free(), but assembled by
getaddrinfo() according to the family's requirement, I don't see a way
how to fix this. IMHO the struct needs to be created officially by
getaddrinfo(), which will lead more or less the the same solution I
posted previously.

Regards,
Andreas



pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: note on dropped columns in pg_attribute
Next
From: Robert Treat
Date:
Subject: Re: note on dropped columns in pg_attribute