summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-01-18 17:59:08 +0100
committerGitHub <noreply@github.com>2024-01-18 17:59:08 +0100
commit4b3ef473c3acfedeb70a023a9ca46df5437fc5a2 (patch)
treef7c0691a21030e43665845eeef8897d82f69e817
parentac7ddf03149e9a3283802ae76c07614ce7eeb8f7 (diff)
parent8be5a47c6e5a7037b7424b1be8ba345c59f53c78 (diff)
downloadvyos-1x-1.4.0-rc3.tar.gz
vyos-1x-1.4.0-rc3.zip
Merge pull request #2851 from vyos/mergify/bp/sagitta/pr-28501.4.0-rc3
ethernet: T4638: deleting parent interface does not delete underlying VIFs (backport #2850)
-rw-r--r--python/vyos/ifconfig/ethernet.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index aaf903acd..dde87149d 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -19,6 +19,7 @@ from glob import glob
from vyos.base import Warning
from vyos.ethtool import Ethtool
+from vyos.ifconfig import Section
from vyos.ifconfig.interface import Interface
from vyos.utils.dict import dict_search
from vyos.utils.file import read_file
@@ -128,6 +129,10 @@ class EthernetIf(Interface):
# will remain visible for the operating system.
self.set_admin_state('down')
+ # Remove all VLAN subinterfaces - filter with the VLAN dot
+ for vlan in [x for x in Section.interfaces(self.iftype) if x.startswith(f'{self.ifname}.')]:
+ Interface(vlan).remove()
+
super().remove()
def set_flow_control(self, enable):