From 46d92ac80bdaa23d11b10b9261aa12a24c5cc5a1 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 17 May 2020 17:34:21 +0200 Subject: dhcpv6-pd: T421: migrate from ISC dhclient to wide-dhcpv6-client ISC does not support running the client on PPP(oE) interfaces which makes it unusable for DHCPv6 Prefix Delegation tasks. Internet Systems Consortium DHCP Client 4.4.1 Copyright 2004-2018 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Unsupported device type 512 for "pppoe0" --- python/vyos/ifconfig/dhcp.py | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'python/vyos/ifconfig') 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): -- cgit v1.2.3