Bug 202215

Summary: /etc/network.subr IP aliases broken for vlan subinterfaces
Product: Base System Reporter: hhw
Component: confAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People Keywords: patch
Priority: ---    
Version: 9.3-RELEASE   
Hardware: Any   
OS: Any   

Description hhw 2015-08-10 10:12:28 UTC
MFC r267812 for normalizing interface names ($_if) with ".+-" in them before using it in a pattern to list_vars() broke the ability to have aliases on vlan sub-interfaces by modifying the value of $_if instead of just using the normalized form for matching.

By using a separate local variable for the matching pattern and leaving the original value of $_if intact, list_vars can return the appropriate values without causing issues for configuring the IP aliases themselves. Unified diff for fix included below:

--- /etc/network.subr.orig      2014-07-10 16:50:15.000000000 -0700
+++ /etc/network.subr   2015-08-10 02:35:39.000000000 -0700
@@ -1010,7 +1010,7 @@
-       local _ret _if _af _action alias ifconfig_args _aliasn _c _tmpargs _iaf
+       local _ret _if _nif _af _action alias ifconfig_args _aliasn _c _tmpargs _iaf
        local _punct=".-/+"
@@ -1020,10 +1020,10 @@
        # Normalize $_if before using it in a pattern to list_vars()
-       ltr "$_if" "$_punct" "_" _if
+       ltr "$_if" "$_punct" "_" _nif
        # ifconfig_IF_aliasN which starts with $_af
-       for alias in `list_vars ifconfig_${_if}_alias[0-9]\* |
+       for alias in `list_vars ifconfig_${_nif}_alias[0-9]\* |
                sort_lite -nk1.$((9+${#_if}+7))`
                eval ifconfig_args=\"\$$alias\"