From nobody@FreeBSD.org  Fri Dec  9 07:00:37 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 454F8106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Dec 2011 07:00:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 1B8468FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Dec 2011 07:00:37 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pB970ak3097577
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 9 Dec 2011 07:00:36 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id pB970adM097576;
	Fri, 9 Dec 2011 07:00:36 GMT
	(envelope-from nobody)
Message-Id: <201112090700.pB970adM097576@red.freebsd.org>
Date: Fri, 9 Dec 2011 07:00:36 GMT
From: Isami Hanaoka <isamihanaoka@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: There is no way to set nic's alias with both IPv4 and IPv6.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         163144
>Category:       conf
>Synopsis:       There is no way to set nic's alias with both IPv4 and IPv6.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    hrs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 09 07:10:02 UTC 2011
>Closed-Date:    Wed Dec 14 01:11:36 UTC 2011
>Last-Modified:  Wed Dec 14 01:11:36 UTC 2011
>Originator:     Isami Hanaoka
>Release:        9.0-RC2
>Organization:
Heart Solutions
>Environment:
FreeBSD minato.private 9.0-RC2 FreeBSD 9.0-RC2 #0: Sat Nov 12 18:35:25 UTC 2011     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
In 9.0-RC2, RC3, "network.subr" uses  "ifconfig_IF_aliasN" for alias setting(both IPv4 and IPv6)

The function named "ifalias_ipv4_up" set IPv4's alias and the function named "if
alias_ipv6_up" set IPv6's alias.
However, the alias index number start from 0 in each function.
so there is no way to set nic's alias with both IPv4 and IPv6.
The only way is using backward compatibility method, such as
"ipv6_ifconfig_IF_aliasN".
But this method generate warning.

>How-To-Repeat:
see my rc.conf:

ifconfig_bge0="inet 192.168.252.170 netmask 255.255.255.0"
ifconfig_bge0_alias0="inet 192.168.253.171 netmask 255.255.255.255"
ifconfig_bge0_alias1="inet 192.168.253.172 netmask 255.255.255.255"
ifconfig_bge0_alias2="inet6 2400:XXXX:XXXX:0000::192.168.253.171 prefixlen 64"
ifconfig_bge0_alias3="inet6 2400:XXXX:XXXX:0000::192.168.253.172 prefixlen 64"

The function named "ifalias_ipv6_up" checks ifconfig_bge0_alias0 first, but
no such variables.
so, this function exit immediately and alias2 and alias3 are ignored. 
>Fix:
Simple solution:
ipv4_alias_up ignores inet6 alias and
ipv6_alias_up ignores inet alias.
I dont know the solutions is best or not.


*** /etc/network.subr-  2011-12-09 15:33:47.471197003 +0900
--- /etc/network.subr   2011-12-09 15:34:43.810200121 +0900
***************
*** 707,712 ****
--- 707,714 ----
                inet\ *)
                        ifconfig $1 ${ifconfig_args} alias && _ret=0
                        ;;
+               inet6\ *)
+                       ;;
                "")
                        break
                        ;;
***************
*** 733,738 ****
--- 735,742 ----
                inet6\ *)
                        ifconfig $1 ${ifconfig_args} alias && _ret=0
                        ;;
+               inet\ *)
+                       ;;
                "")
                        break
                        ;;


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->hrs 
Responsible-Changed-By: hrs 
Responsible-Changed-When: Tue Dec 13 17:17:23 UTC 2011 
Responsible-Changed-Why:  
I'll take this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163144 

From: Hiroki Sato <hrs@FreeBSD.org>
To: isamihanaoka@gmail.com
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: conf/163144: There is no way to set nic's alias with both IPv4
 and IPv6.
Date: Wed, 14 Dec 2011 10:08:25 +0900 (JST)

 ----Security_Multipart(Wed_Dec_14_10_08_25_2011_751)--
 Content-Type: Text/Plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Isami Hanaoka <isamihanaoka@gmail.com> wrote
   in <201112090700.pB970adM097576@red.freebsd.org>:
 
 is> The function named "ifalias_ipv4_up" set IPv4's alias and the function named "if
 is> alias_ipv6_up" set IPv6's alias.
 is> However, the alias index number start from 0 in each function.
 is> so there is no way to set nic's alias with both IPv4 and IPv6.
 is> The only way is using backward compatibility method, such as
 is> "ipv6_ifconfig_IF_aliasN".
 is> But this method generate warning.
 is>
 is> >How-To-Repeat:
 is> see my rc.conf:
 is>
 is> ifconfig_bge0="inet 192.168.252.170 netmask 255.255.255.0"
 is> ifconfig_bge0_alias0="inet 192.168.253.171 netmask 255.255.255.255"
 is> ifconfig_bge0_alias1="inet 192.168.253.172 netmask 255.255.255.255"
 is> ifconfig_bge0_alias2="inet6 2400:XXXX:XXXX:0000::192.168.253.171 prefixlen 64"
 is> ifconfig_bge0_alias3="inet6 2400:XXXX:XXXX:0000::192.168.253.172 prefixlen 64"
 is>
 is> The function named "ifalias_ipv6_up" checks ifconfig_bge0_alias0 first, but
 is> no such variables.
 is> so, this function exit immediately and alias2 and alias3 are ignored.
 
  You have to add ifconfig_bge0_ipv6 if you want to use IPv6 on bge0.
  If not, IPv6 configuration on that interface will be ignored.
 
  Quoted from rc.conf(5):
 
  ifconfig_<interface>_ipv6
       (str) IPv6 functionality on an interface should be configured
       by ifconfig_<interface>_ipv6, instead of setting ifconfig
       parameters in ifconfig_<interface>.  If this variable is
       empty, all of IPv6 configurations on the specified interface
       by other variables such as ipv6_prefix_<interface> will be
       ignored.
 
 -- Hiroki
 
 ----Security_Multipart(Wed_Dec_14_10_08_25_2011_751)--
 Content-Type: application/pgp-signature
 Content-Transfer-Encoding: 7bit
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (FreeBSD)
 
 iEYEABECAAYFAk7n9wkACgkQTyzT2CeTzy3MKQCfbyLZ8U3V+yAda5VU5IoKMYZb
 uzUAoKatjN2kc3ZQ8FEUieAx5ozgXmXb
 =r8gx
 -----END PGP SIGNATURE-----
 
 ----Security_Multipart(Wed_Dec_14_10_08_25_2011_751)----
State-Changed-From-To: open->closed 
State-Changed-By: hrs 
State-Changed-When: Wed Dec 14 01:10:23 UTC 2011 
State-Changed-Why:  
This is due to misconfiguration, not a flaw in network.subr.  

http://www.freebsd.org/cgi/query-pr.cgi?pr=163144 
>Unformatted:
