From owner-freebsd-net@FreeBSD.ORG Fri Jun 20 03:56:15 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 29DB01EB for ; Fri, 20 Jun 2014 03:56:15 +0000 (UTC) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.allbsd.org", Issuer "RapidSSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E127A2DA6 for ; Fri, 20 Jun 2014 03:56:13 +0000 (UTC) Received: from alph.d.allbsd.org ([IPv6:2001:2f0:104:e010:862b:2bff:febc:8956]) (authenticated bits=56) by mail.allbsd.org (8.14.8/8.14.8) with ESMTP id s5K3tpvV015364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 20 Jun 2014 12:56:02 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.8/8.14.8) with ESMTP id s5K3tlDH074362; Fri, 20 Jun 2014 12:55:51 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 20 Jun 2014 12:48:03 +0900 (JST) Message-Id: <20140620.124803.562992300308664968.hrs@allbsd.org> To: jhay@meraka.org.za Subject: Re: network.subr vlan handling broken From: Hiroki Sato In-Reply-To: <20140619103513.GA92393@zibbi.meraka.csir.co.za> References: <20140619103513.GA92393@zibbi.meraka.csir.co.za> 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(Fri_Jun_20_12_48_03_2014_705)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [IPv6:2001:2f0:104:e001::32]); Fri, 20 Jun 2014 12:56:05 +0900 (JST) X-Spam-Status: No, score=-97.7 required=13.0 tests=CONTENT_TYPE_PRESENT, QENCPTR2,RDNS_NONE,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-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2014 03:56:15 -0000 ----Security_Multipart0(Fri_Jun_20_12_48_03_2014_705)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Fri_Jun_20_12_48_03_2014_919)--" Content-Transfer-Encoding: 7bit ----Next_Part(Fri_Jun_20_12_48_03_2014_919)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit John Hay wrote in <20140619103513.GA92393@zibbi.meraka.csir.co.za>: jh> Hi Guys, jh> jh> freebsd-rc did not react, so I'm just checking on -net too. jh> jh> I found after upgrading that vlan handling broke. I tried the following: jh> jh> vlans_bce1="6" jh> ipv4_addrs_bce1_6="inet 10.239.100.2/24" jh> ifconfig_bce1_6_aliases="inet 10.239.100.2/24" jh> ifconfig_bce1_6_alias0="inet 10.239.100.2/24" jh> jh> I traced it down to ifalias_af_common_handler being called with the jh> mangled interfcace name _if and it then calls ifconfig with it. Here jh> is my fix. Any reason not to commit it? My diff is against 10-stable, jh> but head looks the same. Can you try the attached patch? It seemed broken after list_vars() was introduced. Replacing $_if with $1 also fixes it, but $_if should be used for ifname as the other parts do. jh> While looking through the code I saw that ltr is called with different jh> styling. Is there a reason for it? Which is the prefered style? jh> jh> ltr ${_if} "${_punct}" '_' _if jh> ltr "$_if" "$_punct" "_" _if I do not think there is a reason. I think there is no consensus about the style but I am using {} only when boundary between the variable name and the subsequent characters can be ambiguous. -- Hiroki ----Next_Part(Fri_Jun_20_12_48_03_2014_919)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="network.subr-20140620-1.diff" Index: network.subr =================================================================== --- network.subr (revision 267636) +++ network.subr (working copy) @@ -1077,7 +1077,7 @@ ifalias_af_common() { local _ret _if _af _action alias ifconfig_args _aliasn _c _tmpargs _iaf - local _punct=".-/+" + local _vif _punct=".-/+" _ret=1 _aliasn= @@ -1086,11 +1086,11 @@ _action=$3 # Normalize $_if before using it in a pattern to list_vars() - ltr "$_if" "$_punct" "_" _if + ltr "$_if" "$_punct" "_" _vif # ifconfig_IF_aliasN which starts with $_af - for alias in `list_vars ifconfig_${_if}_alias[0-9]\* | - sort_lite -nk1.$((9+${#_if}+7))` + for alias in `list_vars ifconfig_${_vif}_alias[0-9]\* | + sort_lite -nk1.$((9+${#_vif}+7))` do eval ifconfig_args=\"\$$alias\" _iaf= @@ -1118,8 +1118,8 @@ # backward compatibility: ipv6_ifconfig_IF_aliasN. case $_af in inet6) - for alias in `list_vars ipv6_ifconfig_${_if}_alias[0-9]\* | - sort_lite -nk1.$((14+${#_if}+7))` + for alias in `list_vars ipv6_ifconfig_${_vif}_alias[0-9]\* | + sort_lite -nk1.$((14+${#_vif}+7))` do eval ifconfig_args=\"\$$alias\" case ${_action}:"${ifconfig_args}" in @@ -1129,7 +1129,7 @@ alias:*) _aliasn="${_aliasn} inet6 ${ifconfig_args}" warn "\$${alias} is obsolete. " \ - "Use ifconfig_$1_aliasN instead." + "Use ifconfig_${_vif}_aliasN instead." ;; esac done ----Next_Part(Fri_Jun_20_12_48_03_2014_919)---- ----Security_Multipart0(Fri_Jun_20_12_48_03_2014_705)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlOjrvMACgkQTyzT2CeTzy2fTQCfR95aWy54z905YblPX/X90QgX CPQAn1hs2/nSNJaAdC0Wp3meUPyADJM6 =ir9k -----END PGP SIGNATURE----- ----Security_Multipart0(Fri_Jun_20_12_48_03_2014_705)----