mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: vlan: validate vlan interface name
we have an automation test that adds a vrf named "VRF.TEST": $ ifquery -a auto VRF.TEST iface VRF.TEST vrf-table auto $ ifup -a error: could not determine vlanid warning: error while writing to file /sys/class/net/VRF.TEST/mtu: [Errno 22] Invalid argument $ Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
@ -64,13 +64,16 @@ class vlan(Addon, moduleBase):
|
|||||||
Addon.__init__(self)
|
Addon.__init__(self)
|
||||||
moduleBase.__init__(self, *args, **kargs)
|
moduleBase.__init__(self, *args, **kargs)
|
||||||
|
|
||||||
@staticmethod
|
def _is_vlan_device(self, ifaceobj):
|
||||||
def _is_vlan_device(ifaceobj):
|
|
||||||
vlan_raw_device = ifaceobj.get_attr_value_first('vlan-raw-device')
|
vlan_raw_device = ifaceobj.get_attr_value_first('vlan-raw-device')
|
||||||
if vlan_raw_device:
|
if vlan_raw_device:
|
||||||
return True
|
return True
|
||||||
elif '.' in ifaceobj.name:
|
elif '.' in ifaceobj.name:
|
||||||
return True
|
try:
|
||||||
|
if self._get_vlan_id(ifaceobj) != -1:
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Reference in New Issue
Block a user