Skip to content

Commit 8681cca

Browse files
committed
firewall: T8761: Reintroduce VRF-interface names in generated firewall config
1 parent 5c4afee commit 8681cca

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

data/templates/firewall/nftables-zone.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
oifname { {{ zone_conf.member.interface | quoted_join(',') }} } counter jump VZONE_{{ zone_name }}
1313
{% endif %}
1414
{% if 'vrf' in zone_conf.member %}
15+
{% for vrf_name in zone_conf.member.vrf %}
16+
oifname { "{{ zone_conf['vrf_interfaces'][vrf_name] }}" } counter jump VZONE_{{ zone_name }}
17+
{% endfor %}
1518
oifname { {{ zone_conf.member.vrf | quoted_join(",") }} } counter jump VZONE_{{ zone_name }}
1619
{% endif %}
1720
{% endif %}
@@ -71,6 +74,10 @@
7174
oifname { {{ zone[from_zone].member.interface | quoted_join(",") }} } counter return
7275
{% endif %}
7376
{% if 'vrf' in zone[from_zone].member %}
77+
{% for vrf_name in zone[from_zone].member.vrf %}
78+
oifname { "{{ zone[from_zone]['vrf_interfaces'][vrf_name] }}" } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }}
79+
oifname { "{{ zone[from_zone]['vrf_interfaces'][vrf_name] }}" } counter return
80+
{% endfor %}
7481
oifname { {{ zone[from_zone].member.vrf | quoted_join(",") }} } counter jump NAME{{ suffix }}_{{ from_conf.firewall[fw_name] }}
7582
oifname { {{ zone[from_zone].member.vrf | quoted_join(",") }} } counter return
7683
{% endif %}

smoketest/scripts/cli/test_firewall.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,8 +1155,10 @@ def test_zone_with_vrf(self):
11551155
['chain VYOS_ZONE_FORWARD'],
11561156
['type filter hook forward priority filter + 1'],
11571157
['oifname { "eth1", "eth2" }', 'counter packets', 'jump VZONE_ZONE1'],
1158+
['oifname "eth0"', 'counter packets', 'jump VZONE_ZONE1'],
11581159
['oifname "VRF-1"', 'counter packets', 'jump VZONE_ZONE1'],
11591160
['oifname "vtun66"', 'counter packets', 'jump VZONE_ZONE2'],
1161+
['oifname "vti1"', 'counter packets', 'jump VZONE_ZONE2'],
11601162
['oifname "VRF-2"', 'counter packets', 'jump VZONE_ZONE2'],
11611163
['chain VYOS_ZONE_LOCAL'],
11621164
['type filter hook input priority filter + 1'],
@@ -1190,8 +1192,10 @@ def test_zone_with_vrf(self):
11901192
['chain VYOS_ZONE_FORWARD'],
11911193
['type filter hook forward priority filter + 1'],
11921194
['oifname { "eth1", "eth2" }', 'counter packets', 'jump VZONE_ZONE1'],
1195+
['oifname "eth0"', 'counter packets', 'jump VZONE_ZONE1'],
11931196
['oifname "VRF-1"', 'counter packets', 'jump VZONE_ZONE1'],
11941197
['oifname "vtun66"', 'counter packets', 'jump VZONE_ZONE2'],
1198+
['oifname "vti1"', 'counter packets', 'jump VZONE_ZONE2'],
11951199
['oifname "VRF-2"', 'counter packets', 'jump VZONE_ZONE2'],
11961200
['chain VYOS_ZONE_LOCAL'],
11971201
['type filter hook input priority filter + 1'],
@@ -1203,6 +1207,7 @@ def test_zone_with_vrf(self):
12031207
['counter packets', 'drop', 'comment "zone_LOCAL default-action drop"'],
12041208
['chain VZONE_LOCAL_OUT'],
12051209
['oifname "vtun66"', 'counter packets', 'jump NAME6_LOCAL_to_ZONE2_v6'],
1210+
['oifname "vti1"', 'counter packets', 'jump NAME6_LOCAL_to_ZONE2_v6'],
12061211
['oifname "VRF-2"', 'counter packets', 'jump NAME6_LOCAL_to_ZONE2_v6'],
12071212
['counter packets', 'drop', 'comment "zone_LOCAL default-action drop"'],
12081213
['chain VZONE_ZONE1'],

0 commit comments

Comments
 (0)