diff options
-rw-r--r-- | interface-definitions/include/dhcpv6-options.xml.i | 46 | ||||
-rw-r--r-- | interface-definitions/interfaces-pppoe.xml.in | 54 | ||||
-rw-r--r-- | python/vyos/configdict.py | 27 | ||||
-rw-r--r-- | python/vyos/ifconfig_vlan.py | 3 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-bonding.py | 3 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-bridge.py | 3 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-ethernet.py | 3 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-pseudo-ethernet.py | 3 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-wireless.py | 3 |
9 files changed, 92 insertions, 53 deletions
diff --git a/interface-definitions/include/dhcpv6-options.xml.i b/interface-definitions/include/dhcpv6-options.xml.i index c55a5271f..2c5058d2c 100644 --- a/interface-definitions/include/dhcpv6-options.xml.i +++ b/interface-definitions/include/dhcpv6-options.xml.i @@ -3,6 +3,52 @@ <help>DHCPv6 options</help> </properties> <children> + <tagNode name="delegate"> + <properties> + <help>Delegate IPv6 prefix from provider to this interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py --broadcast</script> + </completionHelp> + </properties> + <children> + <leafNode name="interface-id"> + <properties> + <help>Interface address identifier</help> + <valueHelp> + <format>0-</format> + <description>Used to form IPv6 interface address (default: EUI-64)</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--non-negative"/> + </constraint> + </properties> + </leafNode> + <leafNode name="sla-id"> + <properties> + <help>Interface site-Level aggregator (SLA)</help> + <valueHelp> + <format>0-128</format> + <description>Decimal integer which fits in the length of SLA IDs</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 0-128"/> + </constraint> + </properties> + </leafNode> + <leafNode name="sla-len"> + <properties> + <help>Site-Level aggregator (SLA) length</help> + <valueHelp> + <format>0-128</format> + <description>Length of delegated prefix</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 0-128"/> + </constraint> + </properties> + </leafNode> + </children> + </tagNode> <leafNode name="parameters-only"> <properties> <help>Acquire only config parameters, no address</help> diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in index 4337b6fc7..0092f9ce5 100644 --- a/interface-definitions/interfaces-pppoe.xml.in +++ b/interface-definitions/interfaces-pppoe.xml.in @@ -72,59 +72,7 @@ </valueHelp> </properties> </leafNode> - <node name="dhcpv6-options"> - <properties> - <help>DHCPv6 options</help> - </properties> - <children> - <tagNode name="delegate"> - <properties> - <help>Delegate IPv6 prefix from provider to this interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces.py --broadcast</script> - </completionHelp> - </properties> - <children> - <leafNode name="interface-id"> - <properties> - <help>Interface address identifier</help> - <valueHelp> - <format>0-</format> - <description>Used to form IPv6 interface address (default: EUI-64)</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--non-negative"/> - </constraint> - </properties> - </leafNode> - <leafNode name="sla-id"> - <properties> - <help>Interface site-Level aggregator (SLA)</help> - <valueHelp> - <format>0-128</format> - <description>Decimal integer which fits in the length of SLA IDs</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--range 0-128"/> - </constraint> - </properties> - </leafNode> - <leafNode name="sla-len"> - <properties> - <help>Site-Level aggregator (SLA) length</help> - <valueHelp> - <format>0-128</format> - <description>Length of delegated prefix</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--range 0-128"/> - </constraint> - </properties> - </leafNode> - </children> - </tagNode> - </children> - </node> + #include <include/dhcpv6-options.xml.i> #include <include/interface-description.xml.i> #include <include/interface-disable.xml.i> #include <include/interface-vrf.xml.i> 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 diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py index 40fadad27..bdca9d170 100755 --- a/src/conf_mode/interfaces-bonding.py +++ b/src/conf_mode/interfaces-bonding.py @@ -299,6 +299,9 @@ def apply(bond): if bond['dhcpv6_temporary']: b.dhcp.v6.options['dhcpv6_temporary'] = True + if bond['dhcpv6_pd']: + b.dhcp.v6.options['dhcpv6_pd'] = bond['dhcpv6_pd'] + # ignore link state changes b.set_link_detect(bond['disable_link_detect']) # Bonding transmit hash policy diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index d55639019..3ff339f0f 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -321,6 +321,9 @@ def apply(bridge): if bridge['dhcpv6_temporary']: br.dhcp.v6.options['dhcpv6_temporary'] = True + if bridge['dhcpv6_pd']: + br.dhcp.v6.options['dhcpv6_pd'] = br['dhcpv6_pd'] + # assign/remove VRF br.set_vrf(bridge['vrf']) diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py index 97a631158..f45a77a3e 100755 --- a/src/conf_mode/interfaces-ethernet.py +++ b/src/conf_mode/interfaces-ethernet.py @@ -201,6 +201,9 @@ def apply(eth): if eth['dhcpv6_temporary']: e.dhcp.v6.options['dhcpv6_temporary'] = True + if eth['dhcpv6_pd']: + e.dhcp.v6.options['dhcpv6_pd'] = e['dhcpv6_pd'] + # ignore link state changes e.set_link_detect(eth['disable_link_detect']) # disable ethernet flow control (pause frames) diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py index b2f78bcc4..3e036a753 100755 --- a/src/conf_mode/interfaces-pseudo-ethernet.py +++ b/src/conf_mode/interfaces-pseudo-ethernet.py @@ -171,6 +171,9 @@ def apply(peth): if peth['dhcpv6_temporary']: p.dhcp.v6.options['dhcpv6_temporary'] = True + if peth['dhcpv6_pd']: + p.dhcp.v6.options['dhcpv6_pd'] = peth['dhcpv6_pd'] + # ignore link state changes p.set_link_detect(peth['disable_link_detect']) # configure ARP cache timeout in milliseconds diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index c802fdcea..f13408fa2 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -600,6 +600,9 @@ def apply(wifi): if wifi['dhcpv6_temporary']: w.dhcp.v6.options['dhcpv6_temporary'] = True + if wifi['dhcpv6_pd']: + w.dhcp.v6.options['dhcpv6_pd'] = wifi['dhcpv6_pd'] + # ignore link state changes w.set_link_detect(wifi['disable_link_detect']) |