summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-06-25 09:11:44 +0200
committerChristian Poessinger <christian@poessinger.com>2022-06-25 09:13:07 +0200
commitb2fc5f6362a6febddfd5c7735fb3a3781cebf995 (patch)
treef8321f8df4ca1ff8b7dbcfccbc620626a6bd3f62
parent12aeb087c34fe4d5887a11301c2e32e4e1503436 (diff)
downloadvyos-1x-b2fc5f6362a6febddfd5c7735fb3a3781cebf995.tar.gz
vyos-1x-b2fc5f6362a6febddfd5c7735fb3a3781cebf995.zip
dhcp: pppoe: T4384: bugfix not honoring no-default-route CLI option
Commit a2ab95ff68b ("pppoe: T4384: replace default-route CLI option with common CLI nodes already present for DHCP") had an issue as the PPPoE interface options and also DHCP interface options did not honor the no-default-route option. This has been fixed.
-rw-r--r--data/templates/frr/staticd.frr.j24
-rw-r--r--python/vyos/configdict.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/data/templates/frr/staticd.frr.j2 b/data/templates/frr/staticd.frr.j2
index 589f03c2c..55c05ceb7 100644
--- a/data/templates/frr/staticd.frr.j2
+++ b/data/templates/frr/staticd.frr.j2
@@ -17,7 +17,7 @@ vrf {{ vrf }}
{% endif %}
{# IPv4 default routes from DHCP interfaces #}
{% if dhcp is vyos_defined %}
-{% for interface, interface_config in dhcp.items() %}
+{% for interface, interface_config in dhcp.items() if interface_config.dhcp_options.no_default_route is not vyos_defined %}
{% set next_hop = interface | get_dhcp_router %}
{% if next_hop is vyos_defined %}
{{ ip_prefix }} route 0.0.0.0/0 {{ next_hop }} {{ interface }} tag 210 {{ interface_config.dhcp_options.default_route_distance if interface_config.dhcp_options.default_route_distance is vyos_defined }}
@@ -26,7 +26,7 @@ vrf {{ vrf }}
{% endif %}
{# IPv4 default routes from PPPoE interfaces #}
{% if pppoe is vyos_defined %}
-{% for interface, interface_config in pppoe.items() %}
+{% for interface, interface_config in pppoe.items() if interface_config.no_default_route is not vyos_defined %}
{{ ip_prefix }} route 0.0.0.0/0 {{ interface }} tag 210 {{ interface_config.default_route_distance if interface_config.default_route_distance is vyos_defined }}
{% endfor %}
{% endif %}
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 04ddc10e9..7bbf2eae1 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -358,13 +358,14 @@ def get_pppoe_interfaces(conf, vrf=None):
""" Common helper functions to retrieve all interfaces from current CLI
sessions that have DHCP configured. """
pppoe_interfaces = {}
+ conf.set_level([])
for ifname in conf.list_nodes(['interfaces', 'pppoe']):
# always reset config level, as get_interface_dict() will alter it
conf.set_level([])
# we already have a dict representation of the config from get_config_dict(),
# but with the extended information from get_interface_dict() we also
# get the DHCP client default-route-distance default option if not specified.
- ifconfig = get_interface_dict(conf, ['interfaces', 'pppoe'], ifname)
+ _, ifconfig = get_interface_dict(conf, ['interfaces', 'pppoe'], ifname)
options = {}
if 'default_route_distance' in ifconfig: