diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-01 18:48:26 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-02-01 18:51:19 +0100 |
commit | 95f7a440031c58b47fd88d6aa9fac3ddaf6ae231 (patch) | |
tree | fef221c08e569989d80875d7008cbbca375954fb /python/vyos/ifconfig.py | |
parent | 97de067b7c6b8eb3368274237883666f5ad4501e (diff) | |
download | vyos-1x-95f7a440031c58b47fd88d6aa9fac3ddaf6ae231.tar.gz vyos-1x-95f7a440031c58b47fd88d6aa9fac3ddaf6ae231.zip |
ifconfig: T2002: T2009: bugfix for always disabled Ethernet/Bond interfaces
Commit 4a4e2b6 ("ifconfig: T2002: only admin up interfaces if parent interface
is up") contained an inheritance issue where the Ethernet and Bond interface
was always admin down. This was caused by wrong calls in the inheritance
structure.
Diffstat (limited to 'python/vyos/ifconfig.py')
-rw-r--r-- | python/vyos/ifconfig.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 12ab4548d..5d528df36 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -1067,9 +1067,11 @@ class VLANIf(Interface): It makes only sense to change the state of an individual VLAN if the parent interface is up """ - parent_state = self.get_state() + parent_state = Interface(self._ifname).get_state() if parent_state == 'up': super().set_state(state) + else: + self._debug_msg('Parent interface down -> VLAN interface down') def add_vlan(self, vlan_id, ethertype='', ingress_qos='', egress_qos=''): """ @@ -1146,6 +1148,17 @@ class EthernetIf(VLANIf): def __init__(self, ifname): super().__init__(ifname) + def set_state(self, state): + """ + Enable (up) / Disable (down) an interface + """ + + # As we inherit from VLANIf we need to call the Interface.set_state() + # method directly as otherwise the interface will be dead-locked and + # always stay down. + Interface.set_state(self, state) + + def get_driver_name(self): """ Return the driver name used by NIC. Some NICs don't support all @@ -1378,6 +1391,15 @@ class BondIf(VLANIf): i = Interface(slave['ifname']) i.set_state(slave['state']) + def set_state(self, state): + """ + Enable (up) / Disable (down) an interface + """ + + # As we inherit from VLANIf we need to call the Interface.set_state() + # method directly as otherwise the interface will be dead-locked and + # always stay down. + Interface.set_state(self, state) def set_hash_policy(self, mode): """ |