[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: getaddrinfo() may legally return ai_addr = NULL (ITS#1416)

At 01:39 PM 2001-10-30, Stig@OpenLDAP.org wrote:
>On Mon, Oct 29, 2001 at 01:55:20PM +0000, peter.marschall@mayn.de wrote:
>> Full_Name: Peter Marschall
>> Version: 20.0.18
>> OS: Linux 2.4.x
>> URL: ftp://ftp.openldap.org/incoming/peter.marschall-011029.patch
>> Submission from: (NULL) (
>> The man page for getaddrinfo() in the GNU C library states:       
>>        If node is NULL, the network address in each socket struc-
>>        ture  is  initialized  according  to  the AI_PASSIVE flag,
>>        which is set in the ai_flags member of the  hints  parame-
>>        ter.  The network address in each socket structure will be
>>        left unspecified if AI_PASSIVE flag is set.  This is  used
>>        by server applications, which intend to accept client con-
>>        nections on any network address.  The network address will
>>        be set to the loopback interface address if the AI_PASSIVE
>>        flag is not set.  This is  used  by  client  applications,
>>        which  intend  to  connect to a server running on the same
>>        network host.
>> So, at least for glibc, the ai_addr field of the addrinfo structure 
>> may be legally NULL when the AI_PASSIVE flag is set and host is NULL.
>I believe this is just poor language. The draft

s/draft/RFC 2553/

>specs state that if
>AI_PASSIVE is set, the address will be set to INADDR_ANY for IPv4 and
>IN6ADDR_ANY_INIT for IPv6. I think this is what is meant by unspecified
>above. Have you found getaddrinfo() implementations that return just a
>NULL pointer? If so, which? The GNU C library code I have seen, seems
>not to return a NULL pointer, but I might have missed something.