summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/interface.py
diff options
context:
space:
mode:
authorViacheslav <v.gletenko@vyos.io>2021-08-30 06:56:12 +0000
committerViacheslav <v.gletenko@vyos.io>2021-08-30 09:08:32 +0000
commit0aed0434cb118d3de068d3e3ab4dfb23abbf26a3 (patch)
treec86ffb8ba34d6baf1ae7d484ba66a1d8f03fc8b9 /python/vyos/ifconfig/interface.py
parente5796497d5585aac85590e3aa9a80ae67160505a (diff)
downloadvyos-1x-0aed0434cb118d3de068d3e3ab4dfb23abbf26a3.tar.gz
vyos-1x-0aed0434cb118d3de068d3e3ab4dfb23abbf26a3.zip
interface: T3782: Fix unexpected delete qdisc rule
Some tc qdisc rules are generated by old perl code It prevent to unexpected override this code by python.
Diffstat (limited to 'python/vyos/ifconfig/interface.py')
-rwxr-xr-xpython/vyos/ifconfig/interface.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 2a7b1eadc..04e139805 100755
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -1156,12 +1156,14 @@ class Interface(Control):
source_if = next(iter(self._config['is_mirror_intf']))
config = self._config['is_mirror_intf'][source_if].get('mirror', None)
- # Please do not clear the 'set $? = 0 '. It's meant to force a return of 0
- # Remove existing mirroring rules
- delete_tc_cmd = f'tc qdisc del dev {source_if} handle ffff: ingress 2> /dev/null;'
- delete_tc_cmd += f'tc qdisc del dev {source_if} handle 1: root prio 2> /dev/null;'
- delete_tc_cmd += 'set $?=0'
- self._popen(delete_tc_cmd)
+ # Check configuration stored by old perl code before delete T3782
+ if not 'redirect' in self._config:
+ # Please do not clear the 'set $? = 0 '. It's meant to force a return of 0
+ # Remove existing mirroring rules
+ delete_tc_cmd = f'tc qdisc del dev {source_if} handle ffff: ingress 2> /dev/null;'
+ delete_tc_cmd += f'tc qdisc del dev {source_if} handle 1: root prio 2> /dev/null;'
+ delete_tc_cmd += 'set $?=0'
+ self._popen(delete_tc_cmd)
# Bail out early if nothing needs to be configured
if not config: