summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-01 14:04:50 +0200
committerChristian Breunig <christian@breunig.cc>2024-04-04 21:24:54 +0200
commitacb01526bedfb0aa96aa59cad5dec092769bd676 (patch)
treed4af46d0cd7dfb7415389f08e41237e36d5e2097 /python/vyos/ifconfig
parentae96118ec38c4064552889aea5e50023a66aac1e (diff)
downloadvyos-1x-acb01526bedfb0aa96aa59cad5dec092769bd676.tar.gz
vyos-1x-acb01526bedfb0aa96aa59cad5dec092769bd676.zip
dhcpv6-client: T2590: fix vyos-hostsd update for nameserver and search domains
After migrating from ISC DHCLIENT for IPv6 to wide-dhcp-client the logic which was present to update /etc/resolv.conf with the DHCP specified nameservers and also the search domain list was no longer present. This commit adds a per interface rendered script to inform vyos-hostsd about the received IPv6 nameservers and search domains. (cherry picked from commit ece425f0191762638b7c967097accd8739e9103d)
Diffstat (limited to 'python/vyos/ifconfig')
-rw-r--r--python/vyos/ifconfig/interface.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 6b19f12a2..778c601ee 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2021 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -1186,12 +1186,18 @@ class Interface(Control):
ifname = self.ifname
config_file = f'/run/dhcp6c/dhcp6c.{ifname}.conf'
+ script_file = f'/etc/wide-dhcpv6/dhcp6c.{ifname}.script' # can not live under /run b/c of noexec mount option
systemd_override_file = f'/run/systemd/system/dhcp6c@{ifname}.service.d/10-override.conf'
systemd_service = f'dhcp6c@{ifname}.service'
- if enable and 'disable' not in self.config:
- render(systemd_override_file, 'dhcp-client/ipv6.override.conf.j2', self.config)
- render(config_file, 'dhcp-client/ipv6.tmpl', self.config)
+ # Rendered client configuration files require additional settings
+ config = deepcopy(self.config)
+ config['dhcp6_script_file'] = script_file
+
+ if enable and 'disable' not in config:
+ render(systemd_override_file, 'dhcp-client/ipv6.override.conf.j2', config)
+ render(config_file, 'dhcp-client/ipv6.tmpl', config)
+ render(script_file, 'dhcp-client/dhcp6c-script.j2', config, permission=0o755)
# Reload systemd unit definitons as some options are dynamically generated
self._cmd('systemctl daemon-reload')
@@ -1204,6 +1210,8 @@ class Interface(Control):
self._cmd(f'systemctl stop {systemd_service}')
if os.path.isfile(config_file):
os.remove(config_file)
+ if os.path.isfile(script_file):
+ os.remove(script_file)
def set_mirror(self):
# Please refer to the document for details