Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 327059 - sys-apps/openrc-0.6.1: Vlan interfaces are not removed on interface down after rename
Summary: sys-apps/openrc-0.6.1: Vlan interfaces are not removed on interface down afte...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard: openrc:oldnet
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-05 22:05 UTC by Jonathan
Modified: 2010-08-19 21:23 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix detection of renamed vlan interfaces (openrc-vlan-fix.patch,580 bytes, patch)
2010-07-08 15:26 UTC, Jonathan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan 2010-07-05 22:05:26 UTC
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).
Comment 1 William Hubbs gentoo-dev 2010-07-08 04:16:12 UTC
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
Comment 2 Jonathan 2010-07-08 15:23:42 UTC
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.
Comment 3 Jonathan 2010-07-08 15:26:39 UTC
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.
Comment 4 Wormo (RETIRED) gentoo-dev 2010-07-19 05:18:45 UTC
Thanks for submitting a proposed fix -- assigning to maintainers
Comment 5 William Hubbs gentoo-dev 2010-08-19 21:23:01 UTC
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