From ba06bfed4fc84b699689932eeb3af9b9be0f5cd7 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 19 May 2020 21:27:43 +0200 Subject: dhcpv6-pd: T421: support ethernet based interfaces Add support for prefix delegation when receiving the prefix via ethernet, bridge, bond, wireless. --- python/vyos/configdict.py | 27 +++++++++++++++++++++++++++ python/vyos/ifconfig_vlan.py | 3 +++ 2 files changed, 30 insertions(+) (limited to 'python') diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 35c7ad1fc..eec64e964 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -112,6 +112,7 @@ interface_default_data = { 'dhcp_vendor_class_id': '', 'dhcpv6_prm_only': False, 'dhcpv6_temporary': False, + 'dhcpv6_pd': [], 'disable': False, 'disable_link_detect': 1, 'ip_disable_arp_filter': 1, @@ -226,6 +227,32 @@ def intf_to_dict(conf, default): if conf.exists(['dhcpv6-options', 'parameters-only']): intf['dhcpv6_prm_only'] = True + # DHCPv6 prefix delegation (RFC3633) + current_level = conf.get_level() + if conf.exists(['dhcpv6-options', 'delegate']): + for interface in conf.list_nodes(['dhcpv6-options', 'delegate']): + conf.set_level(current_level + ['dhcpv6-options', 'delegate', interface]) + pd = { + 'ifname': interface, + 'sla_id': '', + 'sla_len': '', + 'if_id': '' + } + + if conf.exists(['sla-id']): + pd['sla_id'] = conf.return_value(['sla-id']) + + if conf.exists(['sla-len']): + pd['sla_len'] = conf.return_value(['sla-len']) + + if conf.exists(['interface-id']): + pd['if_id'] = conf.return_value(['interface-id']) + + intf['dhcpv6_pd'].append(pd) + + # re-set config level + conf.set_level(current_level) + # DHCPv6 temporary IPv6 address if conf.exists(['dhcpv6-options', 'temporary']): intf['dhcpv6_temporary'] = True diff --git a/python/vyos/ifconfig_vlan.py b/python/vyos/ifconfig_vlan.py index 6410be9aa..a53136ebf 100644 --- a/python/vyos/ifconfig_vlan.py +++ b/python/vyos/ifconfig_vlan.py @@ -87,6 +87,9 @@ def apply_vlan_config(vlan, config): if config['dhcpv6_temporary']: vlan.dhcp.v6.options['dhcpv6_temporary'] = True + if config['dhcpv6_pd']: + vlan.dhcp.v6.options['dhcpv6_pd'] = config['dhcpv6_pd'] + # update interface description used e.g. within SNMP vlan.set_alias(config['description']) # ignore link state changes -- cgit v1.2.3