diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/ifconfig/interface.py | 13 | ||||
| -rw-r--r-- | python/vyos/qos/base.py | 16 |
2 files changed, 21 insertions, 8 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index bc59d099a..7ae85ae79 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -1781,13 +1781,8 @@ class Interface(Control): 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') else: - # keep the QoS qdiscs, only remove our own (mirred) filters - for tc_filter, _ in self._mirred_filters(source_if, 'ffff:'): - self._popen( - f'tc filter del dev {source_if} parent ffff: ' - f'handle {tc_filter["options"]["fh"]} pref {tc_filter["pref"]} ' - f'protocol {tc_filter["protocol"]} {tc_filter["kind"]}' - ) + # keep the QoS qdiscs and filters, only remove our own redirect filter + self._popen(f'tc filter del dev {source_if} parent ffff: pref 65000 2>/dev/null') # Apply interface mirror policy if 'mirror' in config: @@ -1829,8 +1824,10 @@ class Interface(Control): _, err = self._popen(f'tc qdisc replace dev {source_if} handle ffff: ingress') if err: print(f'tc qdisc add for redirect failed!') + # Lowest priority: an ingress QoS policy polices and redirects the + # traffic it matches first, see vyos.qos.base _, 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'all prio 65000 u32 match u32 0 0 flowid 1:1 action mirred '\ f'egress redirect dev {target_if}') if err: print('tc filter for redirect failed') diff --git a/python/vyos/qos/base.py b/python/vyos/qos/base.py index 651d3f1e1..736b197e1 100644 --- a/python/vyos/qos/base.py +++ b/python/vyos/qos/base.py @@ -242,6 +242,12 @@ class QoSBase: import pprint pprint.pprint(config) + # T6393: traffic of an ingress limiter on an interface with "redirect" + # is redirected after policing, see qos.py apply_interface() + redirect = [] + if 'redirect' in config: + redirect = ['action', 'mirred', 'egress', 'redirect', 'dev', config['redirect']] + if 'class' in config: # T9134: every class match is installed as its own tc filter, and # tc ties a filter priority ("prio"/"pref") to a single protocol - @@ -431,6 +437,7 @@ class QoSBase: # add pedit before flowid for filters without police if dscp_action: filter_cmd += dscp_action + filter_cmd += redirect filter_cmd += ['flowid', f'{self._parent:x}:{cls:x}'] self._cmdl(filter_cmd) @@ -450,6 +457,9 @@ class QoSBase: filter_cmd += ['conform-exceed', str(action)] if 'not_exceed' in cls_config: action = cls_config['not_exceed'] + # "ok" would end the action chain before the redirect + if redirect and action == 'ok': + action = 'pipe' filter_cmd[-1] += f'/{action}' if 'bandwidth' in cls_config: @@ -468,6 +478,7 @@ class QoSBase: filter_cmd += dscp_action cls = int(cls) + filter_cmd += redirect filter_cmd += ['flowid', f'{self._parent:x}:{cls:x}'] self._cmdl(filter_cmd) @@ -547,6 +558,9 @@ class QoSBase: filter_cmd += ['conform-exceed', str(action)] if 'not_exceed' in config['default']: action = config['default']['not_exceed'] + # "ok" would end the action chain before the redirect + if redirect and action == 'ok': + action = 'pipe' filter_cmd[-1] += f'/{action}' if 'bandwidth' in config['default']: @@ -561,6 +575,8 @@ class QoSBase: mtu = config['default']['mtu'] filter_cmd += ['mtu', str(mtu)] + filter_cmd += redirect + if 'class' in config: filter_cmd += ['flowid', f'{self._parent:x}:{default_cls_id:x}'] |
