diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-02-10 19:28:52 +0200 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-02-10 19:39:18 +0200 |
| commit | f94add1ee4eb7255eb5a39d33aa6314d11e8af7e (patch) | |
| tree | 664c9634c64a3b42d95f6ae00aebc01aab9910de /src/conf_mode | |
| parent | 911f8653a813868f2cf805a3a1662eaf16375188 (diff) | |
| download | vyos-1x-f94add1ee4eb7255eb5a39d33aa6314d11e8af7e.tar.gz vyos-1x-f94add1ee4eb7255eb5a39d33aa6314d11e8af7e.zip | |
vpp: T8250: Rewrite the CLI for ACL tcp-flags
Diffstat (limited to 'src/conf_mode')
| -rw-r--r-- | src/conf_mode/vpp_acl.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/conf_mode/vpp_acl.py b/src/conf_mode/vpp_acl.py index cbc915226..f075f9f5e 100644 --- a/src/conf_mode/vpp_acl.py +++ b/src/conf_mode/vpp_acl.py @@ -90,8 +90,8 @@ def create_ip_rules_list(rules): } tcp_flags = rule.get('tcp_flags', {}) - set_flags = [flag for flag in tcp_flags if flag != 'not'] - unet_flags = list(tcp_flags.get('not', {}).keys()) + set_flags = tcp_flags.get('is_set', []) + unet_flags = tcp_flags.get('is_not_set', []) tcp_mask, tcp_value = get_tcp_mask_value(set_flags, unet_flags) r['tcp_flags_mask'] = tcp_mask r['tcp_flags_value'] = tcp_value @@ -262,17 +262,17 @@ def verify(config): f'{err_msg} protocol must be tcp when specifying tcp flags' ) - not_flags = rule_config.get('tcp_flags').get('not', []) - if not_flags: - duplicates = [ - flag - for flag in rule_config.get('tcp_flags') - if flag in not_flags - ] - if duplicates: - raise ConfigError( - f'{err_msg} cannot match a tcp flag as set and not set: {duplicates}' - ) + tcp_flags = rule_config.get('tcp_flags', {}) + flags_set = tcp_flags.get('is_set', []) + flags_not_set = tcp_flags.get('is_not_set', []) + + # same flag cannot be both set and not set + conflict = [flag for flag in flags_set if flag in flags_not_set] + if conflict: + raise ConfigError( + f'{err_msg} cannot match a TCP flag as both set and not set: ' + f'{", ".join(sorted(conflict))}' + ) for iface, iface_config in acl.get('interface', {}).items(): if not any(key in iface_config for key in ('input', 'output')): |
