Using sys-apps/baselayout-1.12.11.1 If a VLAN interface is renamed using a postup script, the VLAN is not properly removed when the base interface is shut down The problem is in the /lib/rcscripts/net/vlan.sh script, vlan_get_vlans() is not properly gathering the VLAN names from /proc/net/vlan/config Reproducible: Always Steps to Reproduce: 1.Configure a network interface (trunk) with vlans: vlans_trunk="10" 2.set vlan_start_trunk="no" 3.start trunk interface 4.rename trunk.10: /sbin/ip link set trunk.10 name myvlan 5.stop trunk interface, notice that the vlan is not removed. 6.start the trunk interface, and note how adding vlan 10 fails, as the vlan already exists. Actual Results: Renamed VLANS are not removed from their host interfaces when the host interface is downed. This leads to errors when restarting interfaces. Expected Results: The renamed VLAN interfaces should be removed, same as those that have not been renamed. This should be the case regardless of the name the VLAN interface has. Using sys-apps/baselayout-1.12.11.1 Replacing the vlan_get_vlans() function in /lib/rcscripts/net/vlan.sh with the following has fixed the error for me. vlan_get_vlans() { sed -n -e 's/^\([^| ]*\).*'"$1"'$/\1/p' \ /proc/net/vlan/config 2>/dev/null } This regex is much simpler than the current one, and I believe, less prone to error (Unless the interface name has a '|' in it, which I don't believe is possible).
There are no plans to fix this in baselayout-1. Can you please upgrade to baselayout-2/openrc and re-open this bug if the issue still exists there? Thanks, William
I am unable to upgrade this system to baselayout-2/openrc at this time. (It is a Production server.) However, I have confirmed that the bug still exists in openrc-0.6.1 See the regex in the _get_vlans() function in net/vlan.sh: _get_vlans() { [ -e /proc/net/vlan/config ] || return 1 sed -n -e 's/^\(.*[0-9]\) \(.* \) .*'"${IFACE}"'$/\1/p' /proc/net/vlan/config } This regex requires that the VLAN names end with a number. This is not always the case if they have been renamed. AFAIK interface names cannot contain spaces. As such, I would recommend replacing the above with the following: _get_vlans() { [ -e /proc/net/vlan/config ] || return 1 sed -n -e 's/^\W*\([^ ]*\) \(.* \) .*'"${IFACE}"'$/\1/p' /proc/net/vlan/config } I have attached a proposed patch for openrc-0.6.1 which should fix the problem.
Created attachment 238037 [details, diff] Fix detection of renamed vlan interfaces Fix the vlan interface name detection in openrc-0.6.1 to detect renamed vlan interfaces.
Thanks for submitting a proposed fix -- assigning to maintainers
Jonathan, your patch has been applied to the git repository and will be released in openrc-0.6.2. Thanks for the report and the patch. William