diff options
| author | Ruben van Dijk <15885455+RubenNL@users.noreply.github.com> | 2025-10-26 11:49:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-26 06:49:09 -0400 |
| commit | 70630267059f9d90f7c0e7bf444b91d5ad52cecd (patch) | |
| tree | 32e59641e4de81a7224dd02d00f3fb49b2b621d3 | |
| parent | fa3414e786d4df0c1f074207094ca776e26250b5 (diff) | |
| download | vyos.vyos-70630267059f9d90f7c0e7bf444b91d5ad52cecd.tar.gz vyos.vyos-70630267059f9d90f7c0e7bf444b91d5ad52cecd.zip | |
T7496 Fix disabling src route (#420)
* T7496 Fix disabling src route (failing tests)
* T7496 Fix disabling src route (bugfix)
* T7496 Fix disabling src route (Changelog)
---------
Co-authored-by: omnom62 <75066712+omnom62@users.noreply.github.com>
Co-authored-by: Gaige B Paulsen <gaige@cluetrust.com>
4 files changed, 7 insertions, 3 deletions
diff --git a/changelogs/fragments/T7496_firewall_global_fix_disabling_src_route.yml b/changelogs/fragments/T7496_firewall_global_fix_disabling_src_route.yml new file mode 100644 index 00000000..aaaf772e --- /dev/null +++ b/changelogs/fragments/T7496_firewall_global_fix_disabling_src_route.yml @@ -0,0 +1,2 @@ +bugfixes: + - vyos_firewall_global - Fix disabling src route diff --git a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py index ed892462..16a91d4e 100644 --- a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py +++ b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py @@ -551,7 +551,7 @@ class Firewall_global(ConfigBase): afi = None afi = None for key, val in w.items(): - if val and key != "afi": + if val is not None and key != "afi": if opr and key in l_set and not (h and self._is_w_same(w, h, key)): commands.append( self._form_attr_cmd( diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_global.py b/tests/unit/modules/network/vyos/test_vyos_firewall_global.py index db67ab2c..862bf06c 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_global.py @@ -109,7 +109,7 @@ class TestVyosFirewallGlobalModule(TestVyosModule): ), dict( afi="ipv6", - ip_src_route=True, + ip_src_route=False, icmp_redirects=dict(receive=False), ), ], @@ -183,6 +183,7 @@ class TestVyosFirewallGlobalModule(TestVyosModule): "set firewall group port-group TELNET description 'This group has the telnet ports'", "set firewall group port-group TELNET", "set firewall ip-src-route 'enable'", + "set firewall ipv6-src-route 'disable'", "set firewall receive-redirects 'disable'", "set firewall config-trap 'enable'", "set firewall ipv6-receive-redirects 'disable'", diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_global14.py b/tests/unit/modules/network/vyos/test_vyos_firewall_global14.py index f1fd708b..efa0e454 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_global14.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_global14.py @@ -109,7 +109,7 @@ class TestVyosFirewallRulesModule14(TestVyosModule): ), dict( afi="ipv6", - ip_src_route=True, + ip_src_route=False, icmp_redirects=dict(receive=False), ), ], @@ -185,6 +185,7 @@ class TestVyosFirewallRulesModule14(TestVyosModule): "set firewall global-options ip-src-route 'enable'", "set firewall global-options receive-redirects 'disable'", "set firewall global-options config-trap 'enable'", + "set firewall global-options ipv6-src-route 'disable'", "set firewall global-options ipv6-receive-redirects 'disable'", "set firewall global-options state-policy established action 'accept'", "set firewall global-options state-policy established log", |
