From owner-svn-src-all@FreeBSD.ORG  Thu Jul 18 02:58:25 2013
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 by hub.freebsd.org (Postfix) with ESMTP id 5BDBE620;
 Thu, 18 Jul 2013 02:58:25 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 by mx1.freebsd.org (Postfix) with ESMTP id 4E76AD72;
 Thu, 18 Jul 2013 02:58:25 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6I2wPA0040141;
 Thu, 18 Jul 2013 02:58:25 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
 by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6I2wPNe040140;
 Thu, 18 Jul 2013 02:58:25 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <201307180258.r6I2wPNe040140@svn.freebsd.org>
From: Hiroki Sato <hrs@FreeBSD.org>
Date: Thu, 18 Jul 2013 02:58:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r253444 - head/etc
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 18 Jul 2013 02:58:25 -0000

Author: hrs
Date: Thu Jul 18 02:58:24 2013
New Revision: 253444
URL: http://svnweb.freebsd.org/changeset/base/253444

Log:
  - Fix a bug in ipv6_prefix_IF.  It did not work with the 64-bit prefix
    notation like 2001:db8:1:1.
  
  - Use eui64 flag in ifconfig(8) instead of network6_getladdr()[*] for
    interface indentifier part.
  
  Suggested by:	ume [*]
  MFC after:	3 days

Modified:
  head/etc/network.subr

Modified: head/etc/network.subr
==============================================================================
--- head/etc/network.subr	Thu Jul 18 02:34:25 2013	(r253443)
+++ head/etc/network.subr	Thu Jul 18 02:58:24 2013	(r253444)
@@ -1052,16 +1052,12 @@ ifalias_af_common()
 #
 ipv6_prefix_hostid_addr_common()
 {
-	local _if _action prefix laddr hostid j address
+	local _if _action prefix j
 	_if=$1
 	_action=$2
 	prefix=`get_if_var ${_if} ipv6_prefix_IF`
 
 	if [ -n "${prefix}" ]; then
-		laddr=`network6_getladdr ${_if}`
-		hostid=${laddr#fe80::}
-		hostid=${hostid%\%*}
-
 		for j in ${prefix}; do
 			# The default prefixlen is 64.
 			plen=${j#*/}
@@ -1071,18 +1067,10 @@ ipv6_prefix_hostid_addr_common()
 			esac
 
 			# Normalize the last part by removing ":"
-			j=${j%:*}
+			j=${j%::*}
 			j=${j%:}
-			OIFS=$IFS; IFS=":"; set -- $j; nj=$#; IFS=$OIFS
-			OIFS=$IFS; IFS=":"; set -- $hostid; nh=$#; IFS=$OIFS
-			if [ $(($nj + $nh)) -eq 8 ]; then
-				address=$j\:$hostid
-			else
-				address=$j\::$hostid
-			fi
-
-			${IFCONFIG_CMD} ${_if} inet6 ${address} \
-				prefixlen $plen ${_action}
+			${IFCONFIG_CMD} ${_if} inet6 $j:: \
+				prefixlen $plen eui64 ${_action}
 
 			# if I am a router, add subnet router
 			# anycast address (RFC 2373).