From owner-freebsd-stable@FreeBSD.ORG Sat Jul 20 14:46:56 2013 Return-Path: Delivered-To: freebsd-stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A0F4D910 for ; Sat, 20 Jul 2013 14:46:56 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) by mx1.freebsd.org (Postfix) with ESMTP id 0DDF23FD for ; Sat, 20 Jul 2013 14:46:55 +0000 (UTC) Received: from alph.d.allbsd.org (p2049-ipbf1102funabasi.chiba.ocn.ne.jp [122.26.101.49]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id r6KEkcPI022701 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 20 Jul 2013 23:46:48 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.5/8.14.5) with ESMTP id r6KEka7g049437; Sat, 20 Jul 2013 23:46:38 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sat, 20 Jul 2013 23:46:23 +0900 (JST) Message-Id: <20130720.234623.829852506076930312.hrs@allbsd.org> To: trashcan@odo.in-berlin.de Subject: Re: ipv6_addrs_IF aliases in rc.conf(5) From: Hiroki Sato In-Reply-To: <20130718.123323.1730389945845032580.hrs@allbsd.org> References: <20130712.160358.1330135778606339435.hrs@allbsd.org> <20130718.123323.1730389945845032580.hrs@allbsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Sat_Jul_20_23_46_23_2013_911)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Sat, 20 Jul 2013 23:46:49 +0900 (JST) X-Spam-Status: No, score=-89.1 required=13.0 tests=CONTENT_TYPE_PRESENT, DIRECTOCNDYN,DYN_PBL,QENCPTR2,RCVD_IN_PBL,RCVD_IN_RP_RNBL,SPF_SOFTFAIL, USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: freebsd-stable@FreeBSD.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jul 2013 14:46:56 -0000 ----Security_Multipart0(Sat_Jul_20_23_46_23_2013_911)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Sat_Jul_20_23_46_23_2013_121)--" Content-Transfer-Encoding: 7bit ----Next_Part(Sat_Jul_20_23_46_23_2013_121)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hiroki Sato wrote in <20130718.123323.1730389945845032580.hrs@allbsd.org>: hr> Michael Grimm wrote hr> in : hr> hr> tr> On 12.07.2013, at 09:03, Hiroki Sato wrote: hr> tr> hr> tr> > Please let me know if the existing configurations and/or the new hr> tr> > formats do not work. hr> tr> hr> tr> First of all: great work! It is that much easier to deal with aliases, now. hr> tr> hr> tr> There is only one minor issue, if at all: hr> tr> hr> tr> rc.conf: hr> tr> | ifconfig_em0_ipv6="inet6 dead:beef:1111:2222::1 prefixlen 56" hr> tr> | ifconfig_em0_aliases="\ hr> tr> | inet6 dead:beef:1111:2222::2-3 prefixlen 56 \ hr> tr> | inet6 dead:beef:1111:2222::4 prefixlen 56 \ hr> tr> | inet6 dead:beef:1111:2222::5-6/56" hr> tr> hr> tr> ifconfig: hr> tr> | inet6 dead:beef:1111:2222::1 prefixlen 56 hr> tr> | inet6 dead:beef:1111:2222::2 prefixlen 64 hr> tr> | inet6 dead:beef:1111:2222::3 prefixlen 64 hr> tr> | inet6 dead:beef:1111:2222::4 prefixlen 56 hr> tr> | inet6 dead:beef:1111:2222::5 prefixlen 56 hr> tr> | inet6 dead:beef:1111:2222::6 prefixlen 56 hr> tr> hr> tr> Any combination of a range definition (2-3) *and* "prefixlen 56" is ignored hr> tr> whereas a range definition (5-6) *and* "/56" is interpreted as wanted. hr> tr> hr> tr> Well, that combination of a range and "prefix" isn't documented, thus I am hr> tr> not sure if that's an issue or a feature? hr> hr> It seems a bug. Thank you for your report. I am investigating it now. Can you test the attached patch? The old version (in stable/9 now) does not support "address range spec + options" properly and ignore the options part. The attached patch accepts options and treats "netmask" for inet and "prefixlen" in inet6 in a reasonable way so that the specified options do not conflict with the default /NN values. -- Hiroki ----Next_Part(Sat_Jul_20_23_46_23_2013_121)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="network.subr.aliases.20130720-1.diff" Index: etc/network.subr =================================================================== --- etc/network.subr (revision 253489) +++ etc/network.subr (working copy) @@ -721,9 +721,14 @@ # ifalias_expand_addr() { + local _af _action - afexists $1 || return - ifalias_expand_addr_$1 $2 $3 + _af=$1 + _action=$2 + shift 2 + + afexists $_af || return + ifalias_expand_addr_$_af $_action $* } # ifalias_expand_addr_inet action addr @@ -731,19 +736,31 @@ # ifalias_expand_addr_inet() { - local _action _arg _cidr _cidr_addr + local _action _arg _cidr _cidr_addr _exargs local _ipaddr _plen _range _iphead _iptail _iplow _iphigh _ipcount local _retstr _c _action=$1 _arg=$2 + shift 2 + _exargs=$* _retstr= - case $_action:$_arg in + case $_action:$_arg:$_exargs in *:*--*) return ;; # invalid - tmp:*) echo $_arg && return ;; # already expanded - tmp:*-*) _action="alias" ;; # to be expanded - *:*-*) ;; # to be expanded - *:*) echo inet $_arg && return ;; # already expanded + tmp:*:*netmask*) # already expanded w/ netmask option + echo ${_arg%/[0-9]*} $_exargs && return + ;; + tmp:*:*) # already expanded w/o netmask option + echo $_arg $_exargs && return + ;; + tmp:*[0-9]-[0-9]*:*) _action="alias" ;; # to be expanded + *:*[0-9]-[0-9]*:*) ;; # to be expanded + *:*:*netmask*) # already expanded w/ netmask option + echo inet ${_arg%/[0-9]*} $_exargs && return + ;; + *:*:*) # already expanded w/o netmask option + echo inet $_arg $_exargs && return + ;; esac for _cidr in $_arg; do @@ -796,7 +813,7 @@ done for _c in $_retstr; do - ifalias_expand_addr_inet $_action $_c + ifalias_expand_addr_inet $_action $_c $_exargs done } @@ -805,20 +822,32 @@ # ifalias_expand_addr_inet6() { - local _action _arg _cidr _cidr_addr + local _action _arg _cidr _cidr_addr _exargs local _ipaddr _plen _ipleft _ipright _iplow _iphigh _ipcount local _ipv4part local _retstr _c _action=$1 _arg=$2 + shift 2 + _exargs=$* _retstr= - case $_action:$_arg in - *:*--*) return ;; # invalid - tmp:*) echo $_arg && return ;; - tmp:*-*) _action="alias" ;; - *:*-*) ;; - *:*) echo inet6 $_arg && return ;; + case $_action:$_arg:$_exargs in + *:*--*:*) return ;; # invalid + tmp:*:*prefixlen*) # already expanded w/ prefixlen option + echo ${_arg%/[0-9]*} $_exargs && return + ;; + tmp:*:*) # already expanded w/o prefixlen option + echo $_arg $_exargs && return + ;; + tmp:*[0-9a-zA-Z]-[0-9a-zA-Z]*:*)_action="alias" ;;# to be expanded + *:*[0-9a-zA-Z]-[0-9a-zA-Z]*:*) ;; # to be expanded + *:*:*prefixlen*) # already expanded w/ prefixlen option + echo inet6 ${_arg%/[0-9]*} $_exargs && return + ;; + *:*:*) # already expanded w/o prefixlen option + echo inet6 $_arg $_exargs && return + ;; esac for _cidr in $_arg; do @@ -872,7 +901,7 @@ fi for _c in $_retstr; do - ifalias_expand_addr_inet6 $_action $_c + ifalias_expand_addr_inet6 $_action $_c $_exargs done else # v4mapped/v4compat should handle as an IPv4 alias @@ -888,7 +917,7 @@ _retstr=`ifalias_expand_addr_inet \ tmp ${_ipv4part}${_plen:+/}${_plen}` for _c in $_retstr; do - ifalias_expand_addr_inet $_action $_c + ifalias_expand_addr_inet $_action $_c $_exargs done fi done ----Next_Part(Sat_Jul_20_23_46_23_2013_121)---- ----Security_Multipart0(Sat_Jul_20_23_46_23_2013_911)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (FreeBSD) iEYEABECAAYFAlHqor8ACgkQTyzT2CeTzy1SjQCgkDjlVNixQRS34lwUjrIcBwET k/kAn3JZfZIz0kkswVa8LJJz3h8ZzaBU =UinY -----END PGP SIGNATURE----- ----Security_Multipart0(Sat_Jul_20_23_46_23_2013_911)----