diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-03-07 22:33:02 +0100 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-03-10 05:15:32 +0100 |
| commit | abc7060ddcca0315682427a1e38faed8cfa01796 (patch) | |
| tree | c5685ed7d549a842b274aa7ea153d0c9d8566654 /python | |
| parent | 87465bd3709aa963d60d593a17f76d4bbd024183 (diff) | |
| download | vyos-1x-abc7060ddcca0315682427a1e38faed8cfa01796.tar.gz vyos-1x-abc7060ddcca0315682427a1e38faed8cfa01796.zip | |
vyos.ifconfig: T8358: clear qdiscs when deleting mirror CLI node
When removing the mirror CLI node to stop mirroring or redirecting traffic
to another interface, the egress configuration was not cleared. This caused
traffic to continue being sent out the SPAN port even after the node was
removed.
Fix by properly clearing all tc(8) qdiscs.
Update smoketests to verify nothing remains after mirror deletion.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/ifconfig/interface.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 33b643e7e..a416de1ab 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -1617,7 +1617,7 @@ class Interface(Control): if 'netns' in self.config: return None - source_if = self.config['ifname'] + source_if = self.ifname mirror_config = None if 'mirror' in self.config: @@ -1631,8 +1631,8 @@ class Interface(Control): # clear existing ingess - ignore errors (e.g. "Error: Cannot find specified # qdisc on specified device") - we simply cleanup all stuff here if not 'qos' in self.config: - self._popen(f'tc qdisc del dev {source_if} parent ffff: 2>/dev/null'); - self._popen(f'tc qdisc del dev {source_if} parent 1: 2>/dev/null'); + self._popen(f'tc qdisc del dev {source_if} root 2>/dev/null') + self._popen(f'tc qdisc del dev {source_if} ingress 2>/dev/null') # Apply interface mirror policy if mirror_config: @@ -1644,14 +1644,14 @@ class Interface(Control): handle = '1: root prio' parent = '1:' - # Mirror egress traffic + # Mirror traffic mirror_cmd = f'tc qdisc add dev {source_if} handle {handle}; ' # Export the mirrored traffic to the interface mirror_cmd += f'tc filter add dev {source_if} parent {parent} protocol '\ f'all prio 10 u32 match u32 0 0 flowid 1:1 action mirred '\ f'egress mirror dev {target_if}' _, err = self._popen(mirror_cmd) - if err: print('tc qdisc(filter for mirror port failed') + if err: print('tc filter for mirror port failed') # Apply interface traffic redirection policy elif 'redirect' in self.config: @@ -1662,7 +1662,7 @@ class Interface(Control): _, err = self._popen(f'tc filter add dev {source_if} parent ffff: protocol '\ f'all prio 10 u32 match u32 0 0 flowid 1:1 action mirred '\ f'egress redirect dev {target_if}') - if err: print('tc filter add for redirect failed') + if err: print('tc filter for redirect failed') def set_per_client_thread(self, enable): """ |
