summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/dhcp-client/ipv6.tmpl12
-rw-r--r--debian/control1
-rw-r--r--python/vyos/ifconfig/dhcp.py25
-rw-r--r--src/systemd/dhclient6@.service18
-rw-r--r--src/systemd/dhcp6c@.service16
5 files changed, 33 insertions, 39 deletions
diff --git a/data/templates/dhcp-client/ipv6.tmpl b/data/templates/dhcp-client/ipv6.tmpl
index be0235add..8485c9d78 100644
--- a/data/templates/dhcp-client/ipv6.tmpl
+++ b/data/templates/dhcp-client/ipv6.tmpl
@@ -1,4 +1,10 @@
# generated by dhcp.py
-interface "{{ ifname }}" {
- request routers, domain-name-servers, domain-name;
-}
+interface {{ ifname }} {
+ request domain-name-servers,domain-name;
+{% if dhcpv6_prm_only %}
+ information-only;
+{% endif %}
+{% if not dhcpv6_temporary %}
+ send ia-na 0;
+{% endif %}
+};
diff --git a/debian/control b/debian/control
index bd6e445ee..eec2c087e 100644
--- a/debian/control
+++ b/debian/control
@@ -40,6 +40,7 @@ Depends: python3,
tcpdump,
tshark,
isc-dhcp-client,
+ wide-dhcpv6-client,
bmon,
hvinfo,
file,
diff --git a/python/vyos/ifconfig/dhcp.py b/python/vyos/ifconfig/dhcp.py
index 57e488cc7..95623a76e 100644
--- a/python/vyos/ifconfig/dhcp.py
+++ b/python/vyos/ifconfig/dhcp.py
@@ -19,11 +19,10 @@ from vyos.dicts import FixedDict
from vyos.ifconfig.control import Control
from vyos.template import render
-config_base = r'/var/lib/dhcp/dhclient_'
-
class _DHCPv4 (Control):
def __init__(self, ifname):
super().__init__()
+ config_base = r'/var/lib/dhcp/dhclient_'
self.options = FixedDict(**{
'ifname': ifname,
'hostname': '',
@@ -85,13 +84,10 @@ class _DHCPv6 (Control):
super().__init__()
self.options = FixedDict(**{
'ifname': ifname,
- 'conf_file': config_base + f'v6_{ifname}.conf',
- 'options_file': config_base + f'v6_{ifname}.options',
- 'pid_file': config_base + f'v6_{ifname}.pid',
- 'lease_file': config_base + f'v6_{ifname}.leases',
'dhcpv6_prm_only': False,
'dhcpv6_temporary': False,
})
+ self._conf_file = f'/run/dhcp6c/dhcp6c.{ifname}.conf'
def set(self):
"""
@@ -111,10 +107,8 @@ class _DHCPv6 (Control):
raise Exception(
'DHCPv6 temporary and parameters-only options are mutually exclusive!')
- render(self.options['options_file'], 'dhcp-client/daemon-options.tmpl', self.options)
- render(self.options['conf_file'], 'dhcp-client/ipv6.tmpl', self.options)
-
- return self._cmd('systemctl restart dhclient6@{ifname}.service'.format(**self.options))
+ render(self._conf_file, 'dhcp-client/ipv6.tmpl', self.options)
+ return self._cmd('systemctl restart dhcp6c@{ifname}.service'.format(**self.options))
def delete(self):
"""
@@ -127,16 +121,11 @@ class _DHCPv6 (Control):
>>> j = Interface('eth0')
>>> j.dhcp.v6.delete()
"""
- if not os.path.isfile(self.options['pid_file']):
- self._debug_msg('No DHCPv6 client PID found')
- return None
-
- self._cmd('systemctl stop dhclient6@{ifname}.service'.format(**self.options))
+ self._cmd('systemctl stop dhcp6c@{ifname}.service'.format(**self.options))
# cleanup old config files
- for name in ('conf_file', 'options_file', 'pid_file', 'lease_file'):
- if os.path.isfile(self.options[name]):
- os.remove(self.options[name])
+ if os.path.isfile(self._conf_file):
+ os.remove(self._conf_file)
class DHCP(object):
diff --git a/src/systemd/dhclient6@.service b/src/systemd/dhclient6@.service
deleted file mode 100644
index fd69e4d48..000000000
--- a/src/systemd/dhclient6@.service
+++ /dev/null
@@ -1,18 +0,0 @@
-[Unit]
-Description=DHCPv6 client on %i
-Documentation=man:dhclient(8)
-ConditionPathExists=/var/lib/dhcp/dhclient_v6_%i.conf
-ConditionPathExists=/var/lib/dhcp/dhclient_v6_%i.options
-After=vyos-router.service
-
-[Service]
-WorkingDirectory=/var/lib/dhcp
-Type=exec
-EnvironmentFile=-/var/lib/dhcp/dhclient_v6_%i.options
-PIDFile=/var/lib/dhcp/dhclient_v6_%i.pid
-ExecStart=/sbin/dhclient -6 $DHCLIENT_OPTS
-ExecStop=/sbin/dhclient -6 $DHCLIENT_OPTS -r
-Restart=always
-
-[Install]
-WantedBy=multi-user.target
diff --git a/src/systemd/dhcp6c@.service b/src/systemd/dhcp6c@.service
new file mode 100644
index 000000000..08c0d57fa
--- /dev/null
+++ b/src/systemd/dhcp6c@.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=WIDE DHCPv6 client on %i
+Documentation=man:dhcp6c(8) man:dhcp6c.conf(5)
+ConditionPathExists=/run/dhcp6c/dhcp6c.%i.conf
+After=vyos-router.service
+
+[Service]
+WorkingDirectory=/run/dhcp6c
+Type=exec
+PIDFile=/run/dhcp6c/dhcp6c.%i.pid
+ExecStart=/usr/sbin/dhcp6c -D -k /run/dhcp6c/dhcp6c.%i.sock -c /run/dhcp6c/dhcp6c.%i.conf -p /run/dhcp6c/dhcp6c.%i.pid %i
+
+Restart=always
+
+[Install]
+WantedBy=multi-user.target