John Hay <j...@meraka.org.za> wrote
  in <20140619103513.ga92...@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
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

Attachment: pgpFShD20w3id.pgp
Description: PGP signature

Reply via email to