Date: Thu, 17 Jan 2013 17:08:10 +0000 (UTC) From: Hajimu UMEMOTO <ume@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r245559 - stable/7/lib/libc/net Message-ID: <201301171708.r0HH8AIU021371@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ume Date: Thu Jan 17 17:08:10 2013 New Revision: 245559 URL: http://svnweb.freebsd.org/changeset/base/245559 Log: MFC r245225, r245256: Restrict use of source address selection of getipnodebyname(1) only to IPv6 address. Modified: stable/7/lib/libc/net/name6.c Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/net/name6.c ============================================================================== --- stable/7/lib/libc/net/name6.c Thu Jan 17 17:07:54 2013 (r245558) +++ stable/7/lib/libc/net/name6.c Thu Jan 17 17:08:10 2013 (r245559) @@ -200,6 +200,7 @@ static struct hostent *_hpmapv6(struct #endif static struct hostent *_hpsort(struct hostent *, res_state); +#ifdef INET6 static struct hostent *_hpreorder(struct hostent *); static int get_addrselectpolicy(struct policyhead *); static void free_addrselectpolicy(struct policyhead *); @@ -209,6 +210,7 @@ static void set_source(struct hp_order static int matchlen(struct sockaddr *, struct sockaddr *); static int comp_dst(const void *, const void *); static int gai_addr2scopetype(struct sockaddr *); +#endif /* * Functions defined in RFC2553 @@ -285,8 +287,10 @@ getipnodebyname(const char *name, int af hp = gethostbyname2(name, af); hp = _hpcopy(hp, errp); - #ifdef INET6 + if (af == AF_INET6) + hp = _hpreorder(hp); + if (af == AF_INET6 && ((flags & AI_ALL) || hp == NULL) && MAPADDRENABLED(flags)) { struct hostent *hp2 = gethostbyname2(name, AF_INET); @@ -309,7 +313,7 @@ getipnodebyname(const char *name, int af *errp = statp->res_h_errno; statp->options = options; - return _hpreorder(_hpsort(hp, statp)); + return _hpsort(hp, statp); } struct hostent * @@ -632,6 +636,7 @@ _hpsort(struct hostent *hp, res_state st return hp; } +#ifdef INET6 /* * _hpreorder: sort address by default address selection */ @@ -1111,3 +1116,4 @@ gai_addr2scopetype(struct sockaddr *sa) return(-1); } } +#endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301171708.r0HH8AIU021371>