freeaddrinfo2 changes.

Lists: pgsql-hackers
From: Kurt Roeckx <Q(at)ping(dot)be>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: freeaddrinfo2 changes.
Date: 2003-06-09 12:29:29
Message-ID: 20030609122929.GA30524@ping.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I just saw in the cvs web that you changed freeaddrinfo2 to not
have the hint af anymore, and use the one from the struct addrinfo
itself.

This can break things. If you called getaddrinfo2() with
AF_UNSPEC, the version from the system can return an AF_UNIX
socket. For instance glibc 2.1 will do that.

The reason freeaddrinfo2 had the hint_ai_family is because that's
how you know we called getaddrinfo_unix, and we allocated the
memory ourself there.

Could you please reverse that change?

Kurt


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kurt Roeckx <Q(at)ping(dot)be>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: freeaddrinfo2 changes.
Date: 2003-06-09 14:09:20
Message-ID: 17164.1055167760@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Kurt Roeckx <Q(at)ping(dot)be> writes:
> I just saw in the cvs web that you changed freeaddrinfo2 to not
> have the hint af anymore, and use the one from the struct addrinfo
> itself.

> This can break things. If you called getaddrinfo2() with
> AF_UNSPEC, the version from the system can return an AF_UNIX
> socket. For instance glibc 2.1 will do that.

If this is broken then it's probably not the only problem --- we rely on
sa.sa_family in other places.

regards, tom lane


From: Kurt Roeckx <Q(at)ping(dot)be>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: freeaddrinfo2 changes.
Date: 2003-06-09 17:18:34
Message-ID: 20030609171834.GA31247@ping.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Jun 09, 2003 at 10:09:20AM -0400, Tom Lane wrote:
> Kurt Roeckx <Q(at)ping(dot)be> writes:
> > I just saw in the cvs web that you changed freeaddrinfo2 to not
> > have the hint af anymore, and use the one from the struct addrinfo
> > itself.
>
> > This can break things. If you called getaddrinfo2() with
> > AF_UNSPEC, the version from the system can return an AF_UNIX
> > socket. For instance glibc 2.1 will do that.
>
> If this is broken then it's probably not the only problem --- we rely on
> sa.sa_family in other places.

sa.sa_family is not the problem itself, the problem is that if
you use getaddrinfo with AF_UNSPEC, you can get more than replies
with more than 1 address family. You will get atleast AF_INET,
AF_INET6 if they exist for what you request, and maybe AF_UNIX or
even others.

Kurt


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kurt Roeckx <Q(at)ping(dot)be>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: freeaddrinfo2 changes.
Date: 2003-06-09 17:25:09
Message-ID: 18560.1055179509@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Kurt Roeckx <Q(at)ping(dot)be> writes:
>> If this is broken then it's probably not the only problem --- we rely on
>> sa.sa_family in other places.

> sa.sa_family is not the problem itself, the problem is that if
> you use getaddrinfo with AF_UNSPEC, you can get more than replies
> with more than 1 address family. You will get atleast AF_INET,
> AF_INET6 if they exist for what you request, and maybe AF_UNIX or
> even others.

Oh, I see --- the problem is to tell the difference between an AF_UNIX
addrinfo built by getaddrinfo_unix and one returned by the system's
getaddrinfo. Okay.

regards, tom lane