summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-25 21:11:43 +0200
committerChristian Poessinger <christian@poessinger.com>2020-05-26 17:09:33 +0200
commit7dddfa338800303335673df637a05d8aaaccdaa2 (patch)
treefc79b7308429223ea2b47be32c213c36d0b729ba
parentd5b58517f88358c686e6c8ea039a7a9a64d6c6ee (diff)
downloadvyos-1x-7dddfa338800303335673df637a05d8aaaccdaa2.tar.gz
vyos-1x-7dddfa338800303335673df637a05d8aaaccdaa2.zip
dhcpv6-pd: T2506: add option to request specific prefix length
Some ISPs (e.g. Comcast) only delegate a /64 by default. You have to explicitly "ask" for a bigger (e.g. /60) prefix. This commit adds a CLI node to request a specific prefix length in the range 32 - 64. dhcpv6-options { prefix-delegation { length 60 } }
-rw-r--r--data/templates/dhcp-client/ipv6.tmpl3
-rw-r--r--python/vyos/configdict.py1
-rw-r--r--python/vyos/ifconfig_vlan.py3
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py3
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py3
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py3
-rwxr-xr-xsrc/conf_mode/interfaces-pppoe.py6
-rwxr-xr-xsrc/conf_mode/interfaces-pseudo-ethernet.py3
-rwxr-xr-xsrc/conf_mode/interfaces-wireless.py3
9 files changed, 28 insertions, 0 deletions
diff --git a/data/templates/dhcp-client/ipv6.tmpl b/data/templates/dhcp-client/ipv6.tmpl
index 8957516e2..490f14726 100644
--- a/data/templates/dhcp-client/ipv6.tmpl
+++ b/data/templates/dhcp-client/ipv6.tmpl
@@ -23,6 +23,9 @@ id-assoc na 1 {
{% if dhcpv6_pd_interfaces %}
id-assoc pd 2 {
+{% if dhcpv6_pd_length %}
+ prefix ::/{{ dhcpv6_pd_length }} infinity;
+{% endif %}
{% for intf in dhcpv6_pd_interfaces %}
prefix-interface {{ intf.ifname }} {
{% if intf.sla_id %}
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 6afc78039..3e1f22d09 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_length': '',
'dhcpv6_pd_interfaces': [],
'disable': False,
'disable_link_detect': 1,
diff --git a/python/vyos/ifconfig_vlan.py b/python/vyos/ifconfig_vlan.py
index ec4d1da42..53a77c651 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_length']:
+ vlan.dhcp.v6.options['dhcpv6_pd_length'] = config['dhcpv6_pd_length']
+
if config['dhcpv6_pd_interfaces']:
vlan.dhcp.v6.options['dhcpv6_pd_interfaces'] = config['dhcpv6_pd_interfaces']
diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py
index b531e97fc..ed9b754c3 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_length']:
+ b.dhcp.v6.options['dhcpv6_pd_length'] = bond['dhcpv6_pd_length']
+
if bond['dhcpv6_pd_interfaces']:
b.dhcp.v6.options['dhcpv6_pd_interfaces'] = bond['dhcpv6_pd_interfaces']
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py
index 865d8a999..adfa81c74 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_length']:
+ br.dhcp.v6.options['dhcpv6_pd_length'] = br['dhcpv6_pd_length']
+
if bridge['dhcpv6_pd_interfaces']:
br.dhcp.v6.options['dhcpv6_pd_interfaces'] = br['dhcpv6_pd_interfaces']
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index 8ffefc7cf..e9cab4be7 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_length']:
+ e.dhcp.v6.options['dhcpv6_pd_length'] = eth['dhcpv6_pd_length']
+
if eth['dhcpv6_pd_interfaces']:
e.dhcp.v6.options['dhcpv6_pd_interfaces'] = eth['dhcpv6_pd_interfaces']
diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py
index e8aeb810f..eaa61cdb6 100755
--- a/src/conf_mode/interfaces-pppoe.py
+++ b/src/conf_mode/interfaces-pppoe.py
@@ -36,6 +36,7 @@ default_config_data = {
'deleted': False,
'description': '\0',
'disable': False,
+ 'dhcpv6_pd_length': '',
'dhcpv6_pd_interfaces': [],
'intf': '',
'idle_timeout': '',
@@ -142,6 +143,11 @@ 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
+ # /64 by default (https://phabricator.vyos.net/T2506)
+ if conf.exists(['length']):
+ pppoe['dhcpv6_pd_length'] = conf.return_value(['length'])
+
for interface in conf.list_nodes(['interface']):
conf.set_level(dhcpv6_pd_path + ['interface', interface])
pd = {
diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py
index c1f52d42c..c09df15e8 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_length']:
+ p.dhcp.v6.options['dhcpv6_pd_length'] = peth['dhcpv6_pd_length']
+
if peth['dhcpv6_pd_interfaces']:
p.dhcp.v6.options['dhcpv6_pd_interfaces'] = peth['dhcpv6_pd_interfaces']
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py
index 54420acd1..8a2736a66 100755
--- a/src/conf_mode/interfaces-wireless.py
+++ b/src/conf_mode/interfaces-wireless.py
@@ -591,6 +591,9 @@ def apply(wifi):
if wifi['dhcpv6_temporary']:
w.dhcp.v6.options['dhcpv6_temporary'] = True
+ if wifi['dhcpv6_pd_length']:
+ w.dhcp.v6.options['dhcpv6_pd_length'] = wifi['dhcpv6_pd_length']
+
if wifi['dhcpv6_pd_interfaces']:
w.dhcp.v6.options['dhcpv6_pd_interfaces'] = wifi['dhcpv6_pd_interfaces']