From owner-freebsd-net@FreeBSD.ORG Fri Jan 4 22:07:28 2008 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C4E616A418 for ; Fri, 4 Jan 2008 22:07:28 +0000 (UTC) (envelope-from cristclark@comcast.net) Received: from QMTA07.emeryville.ca.mail.comcast.net (qmta07.emeryville.ca.mail.comcast.net [76.96.30.64]) by mx1.freebsd.org (Postfix) with ESMTP id 0F1A213C442 for ; Fri, 4 Jan 2008 22:07:27 +0000 (UTC) (envelope-from cristclark@comcast.net) Received: from OMTA10.emeryville.ca.mail.comcast.net ([76.96.30.28]) by QMTA07.emeryville.ca.mail.comcast.net with comcast id Z9lT1Y0020cQ2SL0A01S00; Fri, 04 Jan 2008 21:56:28 +0000 Received: from goku.pumpky.net ([24.6.98.159]) by OMTA10.emeryville.ca.mail.comcast.net with comcast id Z9wC1Y00L3SKeAY8W00000; Fri, 04 Jan 2008 21:56:13 +0000 X-Authority-Analysis: v=1.0 c=1 a=7lkuuOZS6lhDCtfvDzYA:9 a=LhhjC-TvYlbI-hhxb3sA:7 a=Yqvue5ywzW5qU8oDAj0wjrBibHQA:4 a=kJVaTwQnZmMA:10 Received: from goku.pumpky.net (localhost. [127.0.0.1]) by goku.pumpky.net (8.13.8/8.13.8) with ESMTP id m04LuRYj089305 for ; Fri, 4 Jan 2008 13:56:27 -0800 (PST) (envelope-from cristclark@comcast.net) Received: (from cjc@localhost) by goku.pumpky.net (8.13.8/8.13.8/Submit) id m04LuQbY089304 for net@freebsd.org; Fri, 4 Jan 2008 13:56:27 -0800 (PST) (envelope-from cristclark@comcast.net) X-Authentication-Warning: goku.cjclark.org: cjc set sender to cristclark@comcast.net using -f Date: Fri, 4 Jan 2008 13:56:26 -0800 From: "Crist J. Clark" To: net@freebsd.org Message-ID: <20080104215626.GA88922@goku.pumpky.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-URL: http://people.freebsd.org/~cjc/ Cc: Subject: Text for IPv6 Scope X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Crist J. Clark" List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 22:07:28 -0000 Anyone up for adding text to the scopeid field in the ifconfig(8) output for IPv6 addresses? Other OSes do. To avoid too much disruption to the current format, the text is appended after the currently printed hexadecimal field. Example: fxp0: flags=8843 mtu 1500 options=8 inet6 fe80::290:27ff:fe13:2540%fxp0 prefixlen 64 scopeid 0x5(site-local) While we're at it, update the in6.h file to include all scopes in RFC4291. Look OK? Anyone up for applying these? Patches (diffs off of a not-too-current CURRENT): Index: sbin/ifconfig/af_inet6.c =================================================================== RCS file: /ncvs/freebsd/src/sbin/ifconfig/af_inet6.c,v retrieving revision 1.5 diff -u -r1.5 af_inet6.c --- sbin/ifconfig/af_inet6.c 3 Feb 2007 03:40:33 -0000 1.5 +++ sbin/ifconfig/af_inet6.c 4 Jan 2008 21:53:26 -0000 @@ -290,8 +290,31 @@ if ((flags6 & IN6_IFF_TEMPORARY) != 0) printf("temporary "); - if (scopeid) - printf("scopeid 0x%x ", scopeid); + if (scopeid) { + printf("scopeid 0x%x", scopeid); + switch (scopeid) { + case __IPV6_ADDR_SCOPE_INTFACELOCAL: + printf("(interface-local) "); + break; + case __IPV6_ADDR_SCOPE_LINKLOCAL: + printf("(link-local) "); + break; + case __IPV6_ADDR_SCOPE_ADMINLOCAL: + printf("(admin-local) "); + break; + case __IPV6_ADDR_SCOPE_SITELOCAL: + printf("(site-local) "); + break; + case __IPV6_ADDR_SCOPE_ORGLOCAL: + printf("(org-local) "); + break; + case __IPV6_ADDR_SCOPE_GLOBAL: + printf("(global) "); + break; + default: + putchar(' '); + } + } if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) { printf("pltime "); Index: sys/netinet6/in6.h =================================================================== RCS file: /ncvs/freebsd/src/sys/netinet6/in6.h,v retrieving revision 1.44 diff -u -r1.44 in6.h --- sys/netinet6/in6.h 28 Mar 2006 12:51:22 -0000 1.44 +++ sys/netinet6/in6.h 4 Jan 2008 21:44:36 -0000 @@ -271,6 +271,7 @@ #define IPV6_ADDR_SCOPE_NODELOCAL 0x01 #define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 #define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define IPV6_ADDR_SCOPE_ADMINLOCAL 0x04 #define IPV6_ADDR_SCOPE_SITELOCAL 0x05 #define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ #define IPV6_ADDR_SCOPE_GLOBAL 0x0e @@ -278,6 +279,7 @@ #define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 #define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 #define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define __IPV6_ADDR_SCOPE_ADMINLOCAL 0x04 #define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 #define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ #define __IPV6_ADDR_SCOPE_GLOBAL 0x0e -- Crist J. Clark | cjclark@alum.mit.edu