vlan: support "loose binding" to the underlying network device
Currently the UP/DOWN state of VLANs is synchronized to the state of the underlying device, meaning all VLANs are set down once the underlying device is set down. This causes all routes to the VLAN devices to vanish. Add a flag to specify a "loose binding" mode, in which only the operstate is transfered, but the VLAN device state is independant. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
cc83f6d692
commit
5e75659305
@@ -431,6 +431,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
|
||||
struct vlan_group *grp;
|
||||
int i, flgs;
|
||||
struct net_device *vlandev;
|
||||
struct vlan_dev_info *vlan;
|
||||
LIST_HEAD(list);
|
||||
|
||||
if (is_vlan_dev(dev))
|
||||
@@ -507,7 +508,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
|
||||
if (!(flgs & IFF_UP))
|
||||
continue;
|
||||
|
||||
dev_change_flags(vlandev, flgs & ~IFF_UP);
|
||||
vlan = vlan_dev_info(vlandev);
|
||||
if (!(vlan->flags & VLAN_FLAG_LOOSE_BINDING))
|
||||
dev_change_flags(vlandev, flgs & ~IFF_UP);
|
||||
vlan_transfer_operstate(dev, vlandev);
|
||||
}
|
||||
break;
|
||||
@@ -523,7 +526,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
|
||||
if (flgs & IFF_UP)
|
||||
continue;
|
||||
|
||||
dev_change_flags(vlandev, flgs | IFF_UP);
|
||||
vlan = vlan_dev_info(vlandev);
|
||||
if (!(vlan->flags & VLAN_FLAG_LOOSE_BINDING))
|
||||
dev_change_flags(vlandev, flgs | IFF_UP);
|
||||
vlan_transfer_operstate(dev, vlandev);
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user