summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/vyos/ifconfig/dhcp.py19
-rw-r--r--src/systemd/dhclient6@.service12
-rw-r--r--src/systemd/dhclient@.service11
3 files changed, 20 insertions, 22 deletions
diff --git a/python/vyos/ifconfig/dhcp.py b/python/vyos/ifconfig/dhcp.py
index d3e75c292..bf6566c07 100644
--- a/python/vyos/ifconfig/dhcp.py
+++ b/python/vyos/ifconfig/dhcp.py
@@ -19,20 +19,20 @@ 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'/run/dhclient'
self.options = FixedDict(**{
'ifname': ifname,
'hostname': '',
'client_id': '',
'vendor_class_id': '',
- 'conf_file': config_base + f'/{ifname}.conf',
- 'options_file': config_base + f'/{ifname}.options',
- 'pid_file': config_base + f'/{ifname}.pid',
- 'lease_file': config_base + f'/{ifname}.leases',
+ 'conf_file': config_base + f'{ifname}.conf',
+ 'options_file': config_base + f'{ifname}.options',
+ 'pid_file': config_base + f'{ifname}.pid',
+ 'lease_file': config_base + f'{ifname}.leases',
})
# replace dhcpv4/v6 with systemd.networkd?
@@ -83,13 +83,12 @@ class _DHCPv4 (Control):
class _DHCPv6 (Control):
def __init__(self, ifname):
super().__init__()
- config_base = r'/run/dhclient6'
self.options = FixedDict(**{
'ifname': ifname,
- 'conf_file': config_base + f'/{ifname}.conf',
- 'options_file': config_base + f'/{ifname}.options',
- 'pid_file': config_base + f'/{ifname}.pid',
- 'lease_file': config_base + f'/{ifname}.leases',
+ '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,
})
diff --git a/src/systemd/dhclient6@.service b/src/systemd/dhclient6@.service
index d871e7354..fd69e4d48 100644
--- a/src/systemd/dhclient6@.service
+++ b/src/systemd/dhclient6@.service
@@ -1,17 +1,17 @@
[Unit]
Description=DHCPv6 client on %i
Documentation=man:dhclient(8)
-RequiresMountsFor=/run
-ConditionPathExists=/run/dhclient6/%i.conf
-ConditionPathExists=/run/dhclient6/%i.options
+ConditionPathExists=/var/lib/dhcp/dhclient_v6_%i.conf
+ConditionPathExists=/var/lib/dhcp/dhclient_v6_%i.options
After=vyos-router.service
[Service]
-WorkingDirectory=/run/dhclient6
+WorkingDirectory=/var/lib/dhcp
Type=exec
-EnvironmentFile=-/run/dhclient6/%i.options
-PIDFile=/run/dhclient6/%i.pid
+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]
diff --git a/src/systemd/dhclient@.service b/src/systemd/dhclient@.service
index 1040ce2b2..2ced1038a 100644
--- a/src/systemd/dhclient@.service
+++ b/src/systemd/dhclient@.service
@@ -1,16 +1,15 @@
[Unit]
Description=DHCP client on %i
Documentation=man:dhclient(8)
-RequiresMountsFor=/run
-ConditionPathExists=/run/dhclient/%i.conf
-ConditionPathExists=/run/dhclient/%i.options
+ConditionPathExists=/var/lib/dhcp/dhclient_%i.conf
+ConditionPathExists=/var/lib/dhcp/dhclient_%i.options
After=vyos-router.service
[Service]
-WorkingDirectory=/run/dhclient
+WorkingDirectory=/var/lib/dhcp
Type=exec
-EnvironmentFile=-/run/dhclient/%i.options
-PIDFile=/run/dhclient/%i.pid
+EnvironmentFile=-/var/lib/dhcp/dhclient_%i.options
+PIDFile=/var/lib/dhcp/dhclient_%i.pid
ExecStart=/sbin/dhclient -4 $DHCLIENT_OPTS
ExecStop=/sbin/dhclient -4 $DHCLIENT_OPTS -r
Restart=always