[Bug 191961] New: [regression] network.subr fails to assign vlan aliases
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Jul 18 22:52:56 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191961
Bug ID: 191961
Summary: [regression] network.subr fails to assign vlan aliases
Product: Base System
Version: 9.3-RELEASE
Hardware: Any
OS: Any
Status: Needs Triage
Severity: Affects Some People
Priority: ---
Component: conf
Assignee: freebsd-bugs at FreeBSD.org
Reporter: ben at b1c1l1.com
Assigning aliases to vlan interfaces in /etc/rc.conf no longer works in
9.3-RELEASE. The following script demonstrates the problem:
#!/bin/sh
. /etc/rc.subr
. /etc/network.subr
IFCONFIG_CMD="/bin/echo ${IFCONFIG_CMD}"
ifconfig_em0_1_alias0="inet 10.0.16.16/32"
ifconfig_em0_1_alias1="inet 10.0.16.18/32"
ifconfig_em0_1_alias2="inet 10.0.16.20/32"
ifalias_af_common em0.1 inet alias
On 9.3-RELEASE this incorrectly attempts to call ifconfig with "em0_1":
/sbin/ifconfig em0_1 inet 10.0.16.16/32 alias
/sbin/ifconfig em0_1 inet 10.0.16.18/32 alias
/sbin/ifconfig em0_1 inet 10.0.16.20/32 alias
The correct output when run on 9.2-RELEASE:
/sbin/ifconfig em0.1 inet 10.0.16.16/32 alias
/sbin/ifconfig em0.1 inet 10.0.16.18/32 alias
/sbin/ifconfig em0.1 inet 10.0.16.20/32 alias
The relevant commit in stable/9 is r264439 (MFC of r264243).
The original code only normalized (ltr $_if) in subshells so the normalized
value was not exposed to ifalias_af_common_handler(). The following hack fixes
the regression although it should probably be re-factored:
--- /etc/network.subr 2014-07-18 05:33:57.000000000 +0000
+++ network.subr 2014-07-18 22:44:35.000000000 +0000
@@ -1019,11 +1019,9 @@
_af=$2
_action=$3
- # Normalize $_if before using it in a pattern to list_vars()
- ltr "$_if" "$_punct" "_" _if
-
# ifconfig_IF_aliasN which starts with $_af
- for alias in `list_vars ifconfig_${_if}_alias[0-9]\* |
+ for alias in `ltr "$_if" "$_punct" "_" _if;
+ list_vars ifconfig_${_if}_alias[0-9]\* |
sort_lite -nk1.$((9+${#_if}+7))`
do
eval ifconfig_args=\"\$$alias\"
@@ -1053,7 +1051,8 @@
# backward compatibility: ipv6_ifconfig_IF_aliasN.
case $_af in
inet6)
- for alias in `list_vars ipv6_ifconfig_${_if}_alias[0-9]\* |
+ for alias in `ltr "$_if" "$_punct" "_" _if;
+ list_vars ipv6_ifconfig_${_if}_alias[0-9]\* |
sort_lite -nk1.$((14+${#_if}+7))`
do
eval ifconfig_args=\"\$$alias\"
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list