summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-08-04 20:12:23 +0200
committerChristian Breunig <christian@breunig.cc>2023-08-04 20:12:23 +0200
commit292b064d743522d11179bd3cd91a08731380f3a9 (patch)
tree37928a579f4624a447ad46277e43e966f03881ae /src/conf_mode
parent3aac2941efc473c5d52cf9271d778bd51a72dfc7 (diff)
downloadvyos-1x-292b064d743522d11179bd3cd91a08731380f3a9.tar.gz
vyos-1x-292b064d743522d11179bd3cd91a08731380f3a9.zip
dhcp: T5428: provide common direcotry path via vyos.defaults.directories
Multiple scripts use the same hardcoded path for DHCP client leases in different direcotries - this can't be worse.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/vpn_ipsec.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/conf_mode/vpn_ipsec.py b/src/conf_mode/vpn_ipsec.py
index b0825d0ee..51e2869da 100755
--- a/src/conf_mode/vpn_ipsec.py
+++ b/src/conf_mode/vpn_ipsec.py
@@ -28,6 +28,7 @@ from vyos.config import Config
from vyos.configdict import leaf_node_changed
from vyos.configverify import verify_interface_exists
from vyos.configdict import dict_merge
+from vyos.defaults import directories
from vyos.ifconfig import Interface
from vyos.pki import encode_public_key
from vyos.pki import load_private_key
@@ -69,7 +70,6 @@ KEY_PATH = f'{swanctl_dir}/private/'
CA_PATH = f'{swanctl_dir}/x509ca/'
CRL_PATH = f'{swanctl_dir}/x509crl/'
-DHCP_BASE = '/var/lib/dhcp/dhclient'
DHCP_HOOK_IFLIST = '/tmp/ipsec_dhcp_waiting'
def get_config(config=None):
@@ -433,8 +433,9 @@ def verify(ipsec):
dhcp_interface = peer_conf['dhcp_interface']
verify_interface_exists(dhcp_interface)
+ dhcp_base = directories['isc_dhclient_dir']
- if not os.path.exists(f'{DHCP_BASE}_{dhcp_interface}.conf'):
+ if not os.path.exists(f'{dhcp_base}/dhclient_{dhcp_interface}.conf'):
raise ConfigError(f"Invalid dhcp-interface on site-to-site peer {peer}")
address = get_dhcp_address(dhcp_interface)