Date: Thu, 20 Apr 2000 19:15:41 -0400 (EDT) From: Brian Fundakowski Feldman <green@FreeBSD.org> To: Yoshinobu Inoue <shin@FreeBSD.org> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libc/net getaddrinfo.c name6.c Message-ID: <Pine.BSF.4.21.0004201912480.20816-100000@green.dyndns.org> In-Reply-To: <200004200331.UAA85800@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 19 Apr 2000, Yoshinobu Inoue wrote: > Log: > Change getaddrinfo() resolve order > from > all AAAA trial, then all A trial > to > try AAAA and A for each trial I wanted to change this myself, but I didn't feel like getting involved with the getaddrinfo() code too well (I like my sanity, and not the getaddrinfo() code ;). However, I have done the work for the gethostbyname() family. Would you like to review it? Diffs are small, so included. -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green@FreeBSD.org `------------------------------' --- gethostnamadr.c.orig Fri Apr 7 12:11:26 2000 +++ gethostnamadr.c Fri Apr 7 12:15:18 2000 @@ -80,8 +80,6 @@ return SERVICE_NONE; } -static struct hostent *gethostbyname_internal(const char *, int, int); - static void init_services() { @@ -125,21 +123,19 @@ { struct hostent *hp; - return (gethostbyname_internal(name, AF_INET, - (_res.options & RES_USE_INET6) != 0)); + if (_res.options & RES_USE_INET6) { /* XXX */ + hp = gethostbyname2(name, AF_INET6); /* XXX */ + if (hp) /* XXX */ + return (hp); /* XXX */ + } /* XXX */ + return (gethostbyname2(name, AF_INET)); } -static struct hostent * -gethostbyname_internal(const char *name, int type, int doinet6first) +struct hostent * +gethostbyname2(const char *name, int type) { struct hostent *hp = 0; int nserv = 0; - int dohost6first, dobind6first; - - if (doinet6first) - dohost6first = dobind6first = 1; - else - dohost6first = dobind6first = 0; if (!service_done) init_services(); @@ -149,19 +145,9 @@ case SERVICE_NONE: return NULL; case SERVICE_HOSTS: - if (dohost6first) { - dohost6first = 0; - hp = _gethostbyhtname(name, AF_INET6); - continue; - } hp = _gethostbyhtname(name, type); break; case SERVICE_BIND: - if (dobind6first) { - dobind6first = 0; - hp = _gethostbydnsname(name, AF_INET6); - continue; - } hp = _gethostbydnsname(name, type); break; case SERVICE_NIS: @@ -171,12 +157,6 @@ nserv++; } return hp; -} - -struct hostent * -gethostbyname2(const char *name, int type) { - - return (gethostbyname_internal(name, type, 0)); } struct hostent * To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0004201912480.20816-100000>