From 728b1feaf7444545100b9cba7977c90b75f01029 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 6 Jun 2020 01:01:44 +0200 Subject: dhcpv6-pd: T2551: fix prefix length not set in config Retrieving the CLI nodes from current config was missed out and only implemented for PPPoE. --- python/vyos/configdict.py | 12 ++++++++++-- src/conf_mode/interfaces-pppoe.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index ead7e8637..824ca1f71 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -235,8 +235,16 @@ def intf_to_dict(conf, default): # DHCPv6 prefix delegation (RFC3633) current_level = conf.get_level() if conf.exists(['dhcpv6-options', 'prefix-delegation']): - for interface in conf.list_nodes(['dhcpv6-options', 'prefix-delegation', 'interface']): - conf.set_level(current_level + ['dhcpv6-options', 'prefix-delegation', 'interface', interface]) + dhcpv6_pd_path = current_level + ['dhcpv6-options', 'prefix-delegation'] + conf.set_level(dhcpv6_pd_path) + + # retriebe DHCPv6-PD prefix helper length as some ISPs only hand out a + # /64 by default (https://phabricator.vyos.net/T2506) + if conf.exists(['length']): + intf['dhcpv6_pd_length'] = conf.return_value(['length']) + + for interface in conf.list_nodes(['interface']): + conf.set_level(current_level + ['interface', interface]) pd = { 'ifname': interface, 'sla_id': '', diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index 231672490..611206d84 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -145,7 +145,7 @@ def get_config(): 'dhcpv6-options', 'prefix-delegation'] conf.set_level(dhcpv6_pd_path) - # retriebe DHCPv6-PD prefix helper length as some ISPs only hand out a + # Retrieve DHCPv6-PD prefix helper length as some ISPs only hand out a # /64 by default (https://phabricator.vyos.net/T2506) if conf.exists(['length']): pppoe['dhcpv6_pd_length'] = conf.return_value(['length']) -- cgit v1.2.3