From owner-svn-src-head@freebsd.org Thu Jul 28 10:05:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBDBBBA7E61; Thu, 28 Jul 2016 10:05:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7157215E7; Thu, 28 Jul 2016 10:05:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6SA5fA9088614; Thu, 28 Jul 2016 10:05:41 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6SA5frW088611; Thu, 28 Jul 2016 10:05:41 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201607281005.u6SA5frW088611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Thu, 28 Jul 2016 10:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303428 - in head: include lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2016 10:05:42 -0000 Author: ed Date: Thu Jul 28 10:05:41 2016 New Revision: 303428 URL: https://svnweb.freebsd.org/changeset/base/303428 Log: Add NI_NUMERICSCOPE. POSIX also declares NI_NUMERICSCOPE, which makes getnameinfo() return a numerical scope identifier. The interesting thing is that support for this is already present in code, but #ifdef disabled. Expose this functionality by placing a definition for it in . While there, remove references to NI_WITHSCOPEID, as that got removed 11 years ago. Modified: head/include/netdb.h head/lib/libc/net/getnameinfo.3 head/lib/libc/net/getnameinfo.c Modified: head/include/netdb.h ============================================================================== --- head/include/netdb.h Thu Jul 28 09:50:19 2016 (r303427) +++ head/include/netdb.h Thu Jul 28 10:05:41 2016 (r303428) @@ -214,9 +214,7 @@ struct addrinfo { #define NI_NAMEREQD 0x00000004 #define NI_NUMERICSERV 0x00000008 #define NI_DGRAM 0x00000010 -#if 0 /* obsolete */ -#define NI_WITHSCOPEID 0x00000020 -#endif +#define NI_NUMERICSCOPE 0x00000020 /* * Scope delimit character Modified: head/lib/libc/net/getnameinfo.3 ============================================================================== --- head/lib/libc/net/getnameinfo.3 Thu Jul 28 09:50:19 2016 (r303427) +++ head/lib/libc/net/getnameinfo.3 Thu Jul 28 10:05:41 2016 (r303428) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 20, 2015 +.Dd July 28, 2016 .Dt GETNAMEINFO 3 .Os .Sh NAME @@ -111,7 +111,7 @@ The argument is formed by .Tn OR Ns 'ing the following values: -.Bl -tag -width "NI_NUMERICHOSTXX" +.Bl -tag -width "NI_NUMERICSCOPEXX" .It Dv NI_NOFQDN A fully qualified domain name is not required for local hosts. The local part of the fully qualified domain name is returned instead. @@ -127,6 +127,8 @@ If the host name is not found and the fl address is returned in numeric form. .It NI_NUMERICSERV The service name is returned as a digit string representing the port number. +.It NI_NUMERICSCOPE +The scope identifier is returned as a digit string. .It NI_DGRAM Specifies that the service being looked up is a datagram service, and causes Modified: head/lib/libc/net/getnameinfo.c ============================================================================== --- head/lib/libc/net/getnameinfo.c Thu Jul 28 09:50:19 2016 (r303427) +++ head/lib/libc/net/getnameinfo.c Thu Jul 28 10:05:41 2016 (r303428) @@ -378,7 +378,6 @@ ip6_sa2str(const struct sockaddr_in6 *sa ifindex = (unsigned int)sa6->sin6_scope_id; a6 = &sa6->sin6_addr; -#ifdef NI_NUMERICSCOPE if ((flags & NI_NUMERICSCOPE) != 0) { n = snprintf(buf, bufsiz, "%u", sa6->sin6_scope_id); if (n < 0 || n >= bufsiz) @@ -386,7 +385,6 @@ ip6_sa2str(const struct sockaddr_in6 *sa else return n; } -#endif /* if_indextoname() does not take buffer size. not a good api... */ if ((IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6) ||