diff options
author | l0crian1 <ryan.claridge13@gmail.com> | 2024-04-01 11:32:32 -0400 |
---|---|---|
committer | l0crian1 <ryan.claridge13@gmail.com> | 2024-04-01 11:32:32 -0400 |
commit | a7c5205ab12e767c6c60887033694c597e01f21b (patch) | |
tree | f71c30de4154b97686d0a0c5326b64ed3c179cd5 | |
parent | 025438ccacc654274efbd3bea8b13fcc73ae08b6 (diff) | |
download | vyos-1x-a7c5205ab12e767c6c60887033694c597e01f21b.tar.gz vyos-1x-a7c5205ab12e767c6c60887033694c597e01f21b.zip |
T6188:
- modified: src/op_mode/firewall.py
Changed behavior of "show firewall" for specific rule to only show rule and not also default-action
-rwxr-xr-x | src/op_mode/firewall.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/op_mode/firewall.py b/src/op_mode/firewall.py index 411e0be20..aba6f2598 100755 --- a/src/op_mode/firewall.py +++ b/src/op_mode/firewall.py @@ -91,9 +91,6 @@ def get_nftables_details(family, hook, priority): return out def output_firewall_vertical(rules, headers): - if args.rule: - rules.pop() - for rule in rules: adjusted_rule = rule + [""] * (len(headers) - len(rule)) # account for different header length, like default-action transformed_rule = [[header, textwrap.fill(adjusted_rule[i].replace('\n', ' '), 100)] for i, header in enumerate(headers)] # create key-pair list from headers and rules lists; wrap at 100 char @@ -135,6 +132,9 @@ def output_firewall_name(family, hook, priority, firewall_conf, single_rule_id=N rows.append(row) if rows: + if args.rule: + rows.pop() + header = ['Rule', 'Description', 'Action', 'Protocol', 'Packets', 'Bytes', 'Conditions'] if args.detail: output_firewall_vertical(rows, header) |