[Midnightbsd-cvs] src [7487] trunk/lib/libc/net/name6.c: restrict use of source address selection of getipnodebyname(1) only to IPv6 addresses.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Mar 20 17:53:52 EDT 2016
Revision: 7487
http://svnweb.midnightbsd.org/src/?rev=7487
Author: laffer1
Date: 2016-03-20 17:53:51 -0400 (Sun, 20 Mar 2016)
Log Message:
-----------
restrict use of source address selection of getipnodebyname(1) only to IPv6 addresses.
Modified Paths:
--------------
trunk/lib/libc/net/name6.c
Modified: trunk/lib/libc/net/name6.c
===================================================================
--- trunk/lib/libc/net/name6.c 2016-03-20 21:51:49 UTC (rev 7486)
+++ trunk/lib/libc/net/name6.c 2016-03-20 21:53:51 UTC (rev 7487)
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: release/9.2.0/lib/libc/net/name6.c 245553 2013-01-17 16:11:38Z ume $");
#include "namespace.h"
#include <sys/param.h>
@@ -200,6 +200,7 @@
#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 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 @@
hp = gethostbyname2(name, af);
hp = _hpcopy(hp, errp);
+#ifdef INET6
+ if (af == AF_INET6)
+ hp = _hpreorder(hp);
-#ifdef INET6
if (af == AF_INET6 && ((flags & AI_ALL) || hp == NULL) &&
MAPADDRENABLED(flags)) {
struct hostent *hp2 = gethostbyname2(name, AF_INET);
@@ -309,7 +313,7 @@
*errp = statp->res_h_errno;
statp->options = options;
- return _hpreorder(_hpsort(hp, statp));
+ return _hpsort(hp, statp);
}
struct hostent *
@@ -632,6 +636,7 @@
return hp;
}
+#ifdef INET6
/*
* _hpreorder: sort address by default address selection
*/
@@ -1109,3 +1114,4 @@
return(-1);
}
}
+#endif
More information about the Midnightbsd-cvs
mailing list