diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/defaults.py | 3 | ||||
-rw-r--r-- | python/vyos/ifconfig/interface.py | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py index cb3e9b654..a5314790d 100644 --- a/python/vyos/defaults.py +++ b/python/vyos/defaults.py @@ -33,7 +33,8 @@ directories = { 'api_client_op': f'{base_dir}/services/api/graphql/graphql/client_op/', 'api_templates': f'{base_dir}/services/api/graphql/session/templates/', 'vyos_udev_dir' : '/run/udev/vyos', - 'isc_dhclient_dir' : '/run/dhclient' + 'isc_dhclient_dir' : '/run/dhclient', + 'dhcp6_client_dir' : '/run/dhcp6c', } config_status = '/tmp/vyos-config-status' diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index c2787136d..48eb68cae 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -1247,6 +1247,7 @@ class Interface(Control): systemd_override_file = f'/run/systemd/system/dhclient@{ifname}.service.d/10-override.conf' systemd_service = f'dhclient@{ifname}.service' + # Rendered client configuration files require the apsolute config path self.config['isc_dhclient_dir'] = directories['isc_dhclient_dir'] # 'up' check is mandatory b/c even if the interface is A/D, as soon as @@ -1292,14 +1293,21 @@ class Interface(Control): raise ValueError() ifname = self.ifname - config_file = f'/run/dhcp6c/dhcp6c.{ifname}.conf' - options_file = f'/run/dhcp6c/dhcp6c.{ifname}.options' + config_base = directories['dhcp6_client_dir'] + config_file = f'{config_base}/dhcp6c.{ifname}.conf' + systemd_override_file = f'/run/systemd/system/dhcp6c@{ifname}.service.d/10-override.conf' systemd_service = f'dhcp6c@{ifname}.service' + # Rendered client configuration files require the apsolute config path + self.config['dhcp6_client_dir'] = directories['dhcp6_client_dir'] + if enable and 'disable' not in self.config: - render(options_file, 'dhcp-client/dhcp6c_daemon-options.j2', self.config) + render(systemd_override_file, 'dhcp-client/ipv6.override.conf.j2', self.config) render(config_file, 'dhcp-client/ipv6.j2', self.config) + # Reload systemd unit definitons as some options are dynamically generated + self._cmd('systemctl daemon-reload') + # We must ignore any return codes. This is required to enable # DHCPv6-PD for interfaces which are yet not up and running. return self._popen(f'systemctl restart {systemd_service}') |