apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: cvs commit: apr/network_io/unix sa_common.c
Date Tue, 29 Jan 2002 21:39:23 GMT
Jeff Trawick <trawick@attglobal.net> writes:

> >   Index: sa_common.c
> >   ===================================================================
> >   RCS file: /home/cvs/apr/network_io/unix/sa_common.c,v
> >   retrieving revision 1.47
> >   retrieving revision 1.48
> >   diff -u -r1.47 -r1.48
> >   --- sa_common.c	26 Dec 2001 21:18:26 -0000	1.47
> >   +++ sa_common.c	29 Jan 2002 08:37:45 -0000	1.48
> >   @@ -524,6 +524,16 @@
> >                         flags != 0 ? flags : NI_NAMEREQD);
> >        if (rc != 0) {
> >            *hostname = NULL;
> >   +#if 1
> >   +        /* De facto implementations return the error code in their
> >   +         * return value. See isc.org's bind9, or
> >   +         * FreeBSD's lib/libc/net/getnameinfo.c
> >   +         * Implementations that set h_errno a simply broken.
> >   +         * @@ if you encounter one, replace the #if 1 by an
> >   +         * @@ appropriate #ifdef and delete these lines.
> 
> No, that is APR's job to expose the right code.
> 
> >   +         */
> >   +            return rc + APR_OS_START_SYSERR;

I asked a friend to check on the getnameinfo() for a system he works
on (not yet released, so I can't tell you the system).  Their
getnameinfo() returns EAI_xxx codes like getaddrinfo().

For such a system we'd need

                   return rc + APR_OS_START_EAIERR;

in place of your line.

On one level of linux I just tried and h_errno is being set

  getnameinfo 9.9.9.9 0 ni_namereqd
  getnameinfo->-1 (errno 0 h_errno 1)

The "-1" retcode doesn't seem to be the the normal negative-EAI_xxx
value we get with getaddrinfo() on glibc because -1 as an EAI_xxx
value is 

  # define EAI_BADFLAGS   -1      /* Invalid value for `ai_flags' field.  */

and I don't see how NI_NAMEREQD is an invalid set of flags.

On Solaris 8, it looks like EAI_xxx values are returned:

  getnameinfo 9.9.9.9 0 ni_namereqd
  getnameinfo->8 (errno 0 h_errno 0)

  #define EAI_NONAME      8       /* host/servname not known */

On AIX 5L, it looks like EAI_xxx values are returned an h_errno is set
:)

  getnameinfo 9.9.9.9 0 ni_namereqd
  getnameinfo->7 (errno 0 h_errno 1)

  #define EAI_NODATA      7       /* no address associated with hostname */

In order to get to the bottom of this I think that you need to tell me
what sort of error codes are returned by your getnameinfo(); choices I
know of are 

    a) h_errno codes
    b) EAI_xxx codes understood by gai_strerror() (but errno set if EAI_SYSTEM)
    c) something with no rhyme or reason (or at least no way to fit
       into existing APR support)

Then we can see what sort of autodetection would be necessary to cover
the different environments.

Okay?
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message