Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Oct 2015 12:40:55 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288601 - head/lib/libc/net
Message-ID:  <201510031240.t93CetWn097639@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Sat Oct  3 12:40:54 2015
New Revision: 288601
URL: https://svnweb.freebsd.org/changeset/base/288601

Log:
  - Move PF_LOCAL at the end of the array.  PF_INET{,6} is used more often.
  
  - Add SOCKTYPE_ANY to PF_LOCAL.
  
  - Apply AI_CANONNAME to only AF_INET{,6}.  It is not meaningful for the
    other AFs.

Modified:
  head/lib/libc/net/getaddrinfo.c

Modified: head/lib/libc/net/getaddrinfo.c
==============================================================================
--- head/lib/libc/net/getaddrinfo.c	Sat Oct  3 12:09:12 2015	(r288600)
+++ head/lib/libc/net/getaddrinfo.c	Sat Oct  3 12:40:54 2015	(r288601)
@@ -168,12 +168,6 @@ struct explore {
 };
 
 static const struct explore explore[] = {
-	{ PF_LOCAL, SOCK_DGRAM,	ANY,
-	    AF_ANY | PROTOCOL_ANY },
-	{ PF_LOCAL, SOCK_STREAM, ANY,
-	    AF_ANY | PROTOCOL_ANY },
-	{ PF_LOCAL, SOCK_SEQPACKET, ANY,
-	    AF_ANY | PROTOCOL_ANY },
 #ifdef INET6
 	{ PF_INET6, SOCK_DGRAM,	 IPPROTO_UDP,
 	    AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY },
@@ -200,6 +194,12 @@ static const struct explore explore[] = 
 	    AF_ANY | SOCKTYPE_ANY },
 	{ PF_INET, SOCK_RAW, ANY,
 	    AF_ANY | PROTOCOL_ANY },
+	{ PF_LOCAL, SOCK_DGRAM,	ANY,
+	    AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY },
+	{ PF_LOCAL, SOCK_STREAM, ANY,
+	    AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY },
+	{ PF_LOCAL, SOCK_SEQPACKET, ANY,
+	    AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY },
 	{ -1, 0, 0, 0 },
 };
 
@@ -1245,7 +1245,9 @@ explore_numeric(const struct addrinfo *p
 	if (pai->ai_family == afd->a_af) {
 		GET_AI(ai, afd, p);
 		GET_PORT(ai, servname);
-		if ((pai->ai_flags & AI_CANONNAME)) {
+		if ((pai->ai_family == AF_INET ||
+		     pai->ai_family == AF_INET6) &&
+		    (pai->ai_flags & AI_CANONNAME)) {
 			/*
 			 * Set the numeric address itself as the canonical
 			 * name, based on a clarification in RFC3493.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510031240.t93CetWn097639>