diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-11-25 18:50:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-25 18:50:24 +0100 |
commit | 69d9ddf53a2d5d64e2ec47b622338153a3b1b141 (patch) | |
tree | 446f1382783447b5dc8191ed3f812ab37b347d2e | |
parent | e0182613a2013ed7efa5bf99766c89cddefc1b29 (diff) | |
parent | ad8f5762234d6b482b40b574d97fc51f6557daff (diff) | |
download | vyos-1x-69d9ddf53a2d5d64e2ec47b622338153a3b1b141.tar.gz vyos-1x-69d9ddf53a2d5d64e2ec47b622338153a3b1b141.zip |
Merge pull request #1678 from sever-sever/T4825
T4825: Verify if veth interface not used in conf before deleting
-rwxr-xr-x | src/conf_mode/interfaces-virtual-ethernet.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-virtual-ethernet.py b/src/conf_mode/interfaces-virtual-ethernet.py index b1819233c..53422ad2d 100755 --- a/src/conf_mode/interfaces-virtual-ethernet.py +++ b/src/conf_mode/interfaces-virtual-ethernet.py @@ -53,6 +53,13 @@ def get_config(config=None): def verify(veth): if 'deleted' in veth: verify_bridge_delete(veth) + # Prevent to delete veth interface which used for another "vethX peer-name" + for iface, iface_config in veth['other_interfaces'].items(): + if veth['ifname'] in iface_config['peer_name']: + ifname = veth['ifname'] + raise ConfigError( + f'Cannot delete "{ifname}" used for "interface {iface} peer-name"' + ) return None verify_vrf(veth) |