diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-01-31 18:05:18 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-01-31 18:10:56 +0100 |
commit | 4a4e2b6386b4c036bbf4486a8a7ac7002d08158b (patch) | |
tree | 06ab5c2ac465ac127711daee847ccc62eb21ad99 | |
parent | bbc2ab7dcd943c7c2e33606ed598ede304b8c36c (diff) | |
download | vyos-1x-4a4e2b6386b4c036bbf4486a8a7ac7002d08158b.tar.gz vyos-1x-4a4e2b6386b4c036bbf4486a8a7ac7002d08158b.zip |
ifconfig: T2002: only admin up interfaces if parent interface is up
On an A/D (administrative down) interface the VLAN code tries to still admin
up the interface. This won't work and the kernel will complain with:
RTNETLINK answers: Operation not permitted
With this change the VLAN interface is only enabled when the parent interface
is administrative up, too.
-rw-r--r-- | python/vyos/ifconfig.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 90b8fc169..12ab4548d 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -1060,6 +1060,17 @@ class VLANIf(Interface): super().remove() + def set_state(self, state): + """ + Change individual VLAN interface state. + + It makes only sense to change the state of an individual VLAN if the + parent interface is up + """ + parent_state = self.get_state() + if parent_state == 'up': + super().set_state(state) + def add_vlan(self, vlan_id, ethertype='', ingress_qos='', egress_qos=''): """ A virtual LAN (VLAN) is any broadcast domain that is partitioned and |