Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] IPv6 and gethostbyname() -- a look at glibc.
Home

[Freeciv-Dev] IPv6 and gethostbyname() -- a look at glibc.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] IPv6 and gethostbyname() -- a look at glibc.
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: 21 Sep 2000 20:25:43 +0200

Well, I've done what I said I couldn't be bothered to do and had a
look at the glibc sources.

I've only looked at the most recent development version.  Looking at
older versions is too much bother, and I think that this case study is
sufficient anyway.

If you want to check my findings, check out the module "glibc/resolv"
from the GNU CVS repository.  There are instructions on how to do that
at http://subversions.gnu.org .

In res_init.c:res_setoptions() the flag RES_USE_INET6 is set if the
option "inet6" is set in either /etc/resolv.conf (or whatever
_PATH_RESCONF has been redefined to) or in the environment variable
RES_OPTIONS.  When this flag is set, gethostbyname() and friends may
return AF_INET6 entries, viz:

--8<--
struct hostent *
gethostbyname(name)
        const char *name;
{
        struct hostent *hp;

        if ((_res.options & RES_INIT) == 0 && __res_ninit(&_res) ==
        -1) {
                __set_h_errno (NETDB_INTERNAL);
                return (NULL);
       }
        if (_res.options & RES_USE_INET6) {
                hp = gethostbyname2(name, AF_INET6);
                if (hp)
                        return (hp);
        }
        return (gethostbyname2(name, AF_INET));
}
--8<--

Therefore, it is appropriate to check that we get an AF_INET entry in
return, at least until someone makes the effort to make the rest of
Freeciv work properly with IPv6.

-- 
Big Gaute (not to be confused with LG)
After THIS, let's go to PHILADELPHIA and have TRIPLETS!!



[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] IPv6 and gethostbyname() -- a look at glibc., Gaute B Strokkenes <=