diff options
author | l0crian1 <ryan.claridge13@gmail.com> | 2024-03-30 11:21:03 -0400 |
---|---|---|
committer | l0crian1 <ryan.claridge13@gmail.com> | 2024-03-30 11:21:03 -0400 |
commit | b2ced47bdc547ada59b37e6617422188e150282c (patch) | |
tree | 3f0eebca21c36c7139ac9a43f6dcd0e9266ef7ae /src/op_mode | |
parent | a95063831f83dcfe458691b86407b70107b700ad (diff) | |
download | vyos-1x-b2ced47bdc547ada59b37e6617422188e150282c.tar.gz vyos-1x-b2ced47bdc547ada59b37e6617422188e150282c.zip |
T6188: add description to show firewall
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/firewall.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/op_mode/firewall.py b/src/op_mode/firewall.py index 4dcffc412..7134187fe 100755 --- a/src/op_mode/firewall.py +++ b/src/op_mode/firewall.py @@ -103,7 +103,7 @@ def output_firewall_name(family, hook, priority, firewall_conf, single_rule_id=N if 'disable' in rule_conf: continue - row = [rule_id, rule_conf['action'], rule_conf['protocol'] if 'protocol' in rule_conf else 'all'] + row = [rule_id, rule_conf.get('description', ''), rule_conf['action'], rule_conf['protocol'] if 'protocol' in rule_conf else 'all'] if rule_id in details: rule_details = details[rule_id] row.append(rule_details.get('packets', 0)) @@ -115,7 +115,7 @@ def output_firewall_name(family, hook, priority, firewall_conf, single_rule_id=N def_action = firewall_conf['default_action'] if 'default_action' in firewall_conf else 'accept' else: def_action = firewall_conf['default_action'] if 'default_action' in firewall_conf else 'drop' - row = ['default', def_action, 'all'] + row = ['default', '', def_action, 'all'] rule_details = details['default-action'] row.append(rule_details.get('packets', 0)) row.append(rule_details.get('bytes', 0)) @@ -123,7 +123,7 @@ def output_firewall_name(family, hook, priority, firewall_conf, single_rule_id=N rows.append(row) if rows: - header = ['Rule', 'Action', 'Protocol', 'Packets', 'Bytes', 'Conditions'] + header = ['Rule', 'Description', 'Action', 'Protocol', 'Packets', 'Bytes', 'Conditions'] print(tabulate.tabulate(rows, header) + '\n') def output_firewall_name_statistics(family, hook, prior, prior_conf, single_rule_id=None): @@ -192,7 +192,7 @@ def output_firewall_name_statistics(family, hook, prior, prior_conf, single_rule if not oiface: oiface = 'any' - row = [rule_id] + row = [rule_id, rule_conf.get('description', '')] if rule_id in details: rule_details = details[rule_id] row.append(rule_details.get('packets', 0)) @@ -209,7 +209,7 @@ def output_firewall_name_statistics(family, hook, prior, prior_conf, single_rule if hook in ['input', 'forward', 'output']: - row = ['default'] + row = ['default', ''] rule_details = details['default-action'] row.append(rule_details.get('packets', 0)) row.append(rule_details.get('bytes', 0)) @@ -224,7 +224,7 @@ def output_firewall_name_statistics(family, hook, prior, prior_conf, single_rule rows.append(row) elif 'default_action' in prior_conf and not single_rule_id: - row = ['default'] + row = ['default', ''] if 'default-action' in details: rule_details = details['default-action'] row.append(rule_details.get('packets', 0)) @@ -240,7 +240,7 @@ def output_firewall_name_statistics(family, hook, prior, prior_conf, single_rule rows.append(row) if rows: - header = ['Rule', 'Packets', 'Bytes', 'Action', 'Source', 'Destination', 'Inbound-Interface', 'Outbound-interface'] + header = ['Rule', 'Description', 'Packets', 'Bytes', 'Action', 'Source', 'Destination', 'Inbound-Interface', 'Outbound-interface'] print(tabulate.tabulate(rows, header) + '\n') def show_firewall(): |