diff options
author | Christian Breunig <christian@breunig.cc> | 2023-10-25 20:30:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 20:30:08 +0200 |
commit | ef55eab3c7cdac7b8febca9af15b5118aa475c45 (patch) | |
tree | cdd435b79159542d8ccbfe3d3fdfe8a16356c3ee /python | |
parent | 73eb7777a5d3a3bce48719f651c6b0f3a1c1a79d (diff) | |
parent | 51abbc0f1b2ccf4785cf7f29f1fe6f4af6007ee6 (diff) | |
download | vyos-1x-ef55eab3c7cdac7b8febca9af15b5118aa475c45.tar.gz vyos-1x-ef55eab3c7cdac7b8febca9af15b5118aa475c45.zip |
Merge pull request #2406 from nicolas-fort/T5681
T5681: Firewall,Nat and Nat66: simplified and standarize interface matcher
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/firewall.py | 12 | ||||
-rw-r--r-- | python/vyos/nat.py | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py index c07ed1adf..dc5787595 100644 --- a/python/vyos/firewall.py +++ b/python/vyos/firewall.py @@ -275,14 +275,14 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name): if 'inbound_interface' in rule_conf: operator = '' - if 'interface_name' in rule_conf['inbound_interface']: - iiface = rule_conf['inbound_interface']['interface_name'] + if 'name' in rule_conf['inbound_interface']: + iiface = rule_conf['inbound_interface']['name'] if iiface[0] == '!': operator = '!=' iiface = iiface[1:] output.append(f'iifname {operator} {{{iiface}}}') else: - iiface = rule_conf['inbound_interface']['interface_group'] + iiface = rule_conf['inbound_interface']['group'] if iiface[0] == '!': operator = '!=' iiface = iiface[1:] @@ -290,14 +290,14 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name): if 'outbound_interface' in rule_conf: operator = '' - if 'interface_name' in rule_conf['outbound_interface']: - oiface = rule_conf['outbound_interface']['interface_name'] + if 'name' in rule_conf['outbound_interface']: + oiface = rule_conf['outbound_interface']['name'] if oiface[0] == '!': operator = '!=' oiface = oiface[1:] output.append(f'oifname {operator} {{{oiface}}}') else: - oiface = rule_conf['outbound_interface']['interface_group'] + oiface = rule_conf['outbound_interface']['group'] if oiface[0] == '!': operator = '!=' oiface = oiface[1:] diff --git a/python/vyos/nat.py b/python/vyos/nat.py index e32b5ae74..392d38772 100644 --- a/python/vyos/nat.py +++ b/python/vyos/nat.py @@ -33,14 +33,14 @@ def parse_nat_rule(rule_conf, rule_id, nat_type, ipv6=False): if 'inbound_interface' in rule_conf: operator = '' - if 'interface_name' in rule_conf['inbound_interface']: - iiface = rule_conf['inbound_interface']['interface_name'] + if 'name' in rule_conf['inbound_interface']: + iiface = rule_conf['inbound_interface']['name'] if iiface[0] == '!': operator = '!=' iiface = iiface[1:] output.append(f'iifname {operator} {{{iiface}}}') else: - iiface = rule_conf['inbound_interface']['interface_group'] + iiface = rule_conf['inbound_interface']['group'] if iiface[0] == '!': operator = '!=' iiface = iiface[1:] @@ -48,14 +48,14 @@ def parse_nat_rule(rule_conf, rule_id, nat_type, ipv6=False): if 'outbound_interface' in rule_conf: operator = '' - if 'interface_name' in rule_conf['outbound_interface']: - oiface = rule_conf['outbound_interface']['interface_name'] + if 'name' in rule_conf['outbound_interface']: + oiface = rule_conf['outbound_interface']['name'] if oiface[0] == '!': operator = '!=' oiface = oiface[1:] output.append(f'oifname {operator} {{{oiface}}}') else: - oiface = rule_conf['outbound_interface']['interface_group'] + oiface = rule_conf['outbound_interface']['group'] if oiface[0] == '!': operator = '!=' oiface = oiface[1:] |