summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/frr/staticd.frr.j211
-rw-r--r--python/vyos/configdict.py8
2 files changed, 14 insertions, 5 deletions
diff --git a/data/templates/frr/staticd.frr.j2 b/data/templates/frr/staticd.frr.j2
index 08b2a3dab..cf8448f7f 100644
--- a/data/templates/frr/staticd.frr.j2
+++ b/data/templates/frr/staticd.frr.j2
@@ -18,9 +18,14 @@ vrf {{ vrf }}
{# IPv4 default routes from DHCP interfaces #}
{% if dhcp is vyos_defined %}
{% for interface, interface_config in dhcp.items() %}
-{% 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.distance }}
+{# PPPoE routes behave a bit different ... #}
+{% if interface.startswith('pppoe') and interface_config.default_route is vyos_defined and interface_config.default_route is not vyos_defined('none') %}
+{{ ip_prefix }} route 0.0.0.0/0 {{ interface }} tag 210
+{% else %}
+{% 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.distance if interface_config.distance is vyos_defined }}
+{% endif %}
{% endif %}
{% endfor %}
{% endif %}
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index f50db0c99..3f5b9a246 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -335,10 +335,12 @@ def get_dhcp_interfaces(conf, vrf=None):
def check_dhcp(config, ifname):
tmp = {}
- if 'address' in config and 'dhcp' in config['address']:
+ if dict_search('address', config) == 'dhcp' or dict_search('default_route', config) != None:
options = {}
- if 'dhcp_options' in config and 'default_route_distance' in config['dhcp_options']:
+ if dict_search('dhcp_options.default_route_distance', config) != None:
options.update({'distance' : config['dhcp_options']['default_route_distance']})
+ if dict_search('default_route', config) != None:
+ options.update({'distance' : config['default_route']})
if 'vrf' in config:
if vrf is config['vrf']: tmp.update({ifname : options})
else: tmp.update({ifname : options})
@@ -346,6 +348,8 @@ def get_dhcp_interfaces(conf, vrf=None):
for section, interface in dict.items():
for ifname in interface:
+ # always reset config level
+ 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.