diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-05-19 21:27:43 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-05-19 21:27:43 +0200 |
commit | ba06bfed4fc84b699689932eeb3af9b9be0f5cd7 (patch) | |
tree | 8dc39b8e3adc90e080226e142c5423e4f8c88e0e /python/vyos | |
parent | e62218c87a99e8500f0ff0925c349db9efade262 (diff) | |
download | vyos-1x-ba06bfed4fc84b699689932eeb3af9b9be0f5cd7.tar.gz vyos-1x-ba06bfed4fc84b699689932eeb3af9b9be0f5cd7.zip |
dhcpv6-pd: T421: support ethernet based interfaces
Add support for prefix delegation when receiving the prefix via ethernet,
bridge, bond, wireless.
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/configdict.py | 27 | ||||
-rw-r--r-- | python/vyos/ifconfig_vlan.py | 3 |
2 files changed, 30 insertions, 0 deletions
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 |