diff options
| author | Christian Breunig <christian@breunig.cc> | 2023-08-05 09:02:59 +0200 | 
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2023-08-05 09:28:35 +0200 | 
| commit | 8a15595e1ac3d9e3e15f40f8b2256768f8d71f0c (patch) | |
| tree | 2ecb45cd5ab98423ad534c415e2703e09f96c468 /python | |
| parent | 6fbce6b6fe495268f896f95fea1a0837367c664a (diff) | |
| download | vyos-1x-8a15595e1ac3d9e3e15f40f8b2256768f8d71f0c.tar.gz vyos-1x-8a15595e1ac3d9e3e15f40f8b2256768f8d71f0c.zip | |
dhcpv6: T5428: client renewal fails when running inside VRF
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}') | 
