summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav <v.gletenko@vyos.io>2021-08-31 08:32:49 +0000
committerViacheslav <v.gletenko@vyos.io>2021-08-31 08:32:56 +0000
commit4281fb32ebba0f1e0c76bf1f21eea7defe65a1a9 (patch)
treea7c8ccb6111309095bbe821365de6a7e5fadc313
parent11fdcb7cdd078e67b460b6863f8fd9785c33dc2d (diff)
downloadvyos-1x-4281fb32ebba0f1e0c76bf1f21eea7defe65a1a9.tar.gz
vyos-1x-4281fb32ebba0f1e0c76bf1f21eea7defe65a1a9.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.
-rw-r--r--python/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 d47403488..c53bb964a 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -1079,12 +1079,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: