Bug 202215 - /etc/network.subr IP aliases broken for vlan subinterfaces
Summary: /etc/network.subr IP aliases broken for vlan subinterfaces
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 9.3-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
Keywords: patch
Depends on:
Reported: 2015-08-10 10:12 UTC by hhw
Modified: 2015-08-11 03:21 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
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\"