summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-19 19:59:34 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-19 20:01:01 +0200
commitc9b33da5260db44c70e066f61711e61f7341bf1e (patch)
treee9db072297b75e08108fc3837f531b7d63d7db6f /python
parent07af15bb39f6a52a4fd240f54e22b518908fed53 (diff)
downloadvyos-1x-c9b33da5260db44c70e066f61711e61f7341bf1e.tar.gz
vyos-1x-c9b33da5260db44c70e066f61711e61f7341bf1e.zip
pppoe: static: T4379: bugfix default-route lost after applying additional static routes
Issue is identical to the problem in T3680 (05aa22dcb4ce) which was for DHCP based routes. Once a static route is added to the system, the PPPoE auto-installed default route is lost.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configdict.py8
1 files changed, 6 insertions, 2 deletions
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.