summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-11-25 08:23:21 -0600
committerGitHub <noreply@github.com>2025-11-25 08:23:21 -0600
commit48fe045a75a52e40217be4ba5a9696bc9ed2111b (patch)
tree0fe28ebc5b09faa01b78da030646018d6f9807ec
parentfdda826b48688e253c30d3578ca5edd45b034ab0 (diff)
parent3ca132fe22f732a7d4191e7e1c1d2b00d4206690 (diff)
downloadvyos-1x-48fe045a75a52e40217be4ba5a9696bc9ed2111b.tar.gz
vyos-1x-48fe045a75a52e40217be4ba5a9696bc9ed2111b.zip
Merge pull request #4860 from sarthurdev/ping-check
kea: T7913: Fixes for ping-check handling
-rw-r--r--data/templates/dhcp-server/kea-dhcp4.conf.j27
-rw-r--r--python/vyos/kea.py2
-rwxr-xr-xpython/vyos/template.py12
-rwxr-xr-xsrc/conf_mode/service_dhcp-server.py4
4 files changed, 20 insertions, 5 deletions
diff --git a/data/templates/dhcp-server/kea-dhcp4.conf.j2 b/data/templates/dhcp-server/kea-dhcp4.conf.j2
index 7302c2cad..8519689a9 100644
--- a/data/templates/dhcp-server/kea-dhcp4.conf.j2
+++ b/data/templates/dhcp-server/kea-dhcp4.conf.j2
@@ -28,6 +28,9 @@
"persist": true,
"name": "{{ lease_file }}"
},
+ "multi-threading": {
+ "enable-multi-threading": true
+ },
{% if client_class is vyos_defined %}
"client-classes": {{ client_class | kea_client_class_json }},
{% endif %}
@@ -75,16 +78,18 @@
}
},
{% endif %}
+{% if any_ping_check is vyos_defined %}
{
"library": "/usr/lib/{{ machine }}-linux-gnu/kea/hooks/libdhcp_ping_check.so",
"parameters": {
- "enable-ping-check" : false,
+ "enable-ping-check" : true,
"min-ping-requests" : 1,
"reply-timeout" : 100,
"ping-cltt-secs" : 60,
"ping-channel-threads" : 0
}
},
+{% endif %}
{
"library": "/usr/lib/{{ machine }}-linux-gnu/kea/hooks/libdhcp_lease_cmds.so",
"parameters": {}
diff --git a/python/vyos/kea.py b/python/vyos/kea.py
index 323fded5d..a8b38d999 100644
--- a/python/vyos/kea.py
+++ b/python/vyos/kea.py
@@ -158,7 +158,7 @@ def kea_parse_options(config):
def kea_parse_subnet(subnet, config):
- out = {'subnet': subnet, 'id': int(config['subnet_id']), 'user-context': {}}
+ out = {'subnet': subnet, 'id': int(config['subnet_id']), 'user-context': {'enable-ping-check': False}}
if 'option' in config:
out['option-data'] = kea_parse_options(config['option'])
diff --git a/python/vyos/template.py b/python/vyos/template.py
index 44278e963..128471f42 100755
--- a/python/vyos/template.py
+++ b/python/vyos/template.py
@@ -1015,7 +1015,7 @@ def kea_shared_network_json(shared_networks):
'name': name,
'authoritative': ('authoritative' in config),
'subnet4': [],
- 'user-context': {}
+ 'user-context': {'enable-ping-check': False}
}
if 'dynamic_dns_update' in config:
@@ -1030,15 +1030,21 @@ def kea_shared_network_json(shared_networks):
if 'bootfile_server' in config['option']:
network['next-server'] = config['option']['bootfile_server']
- if 'ping_check' in config:
- network['user-context']['enable-ping-check'] = True
+ subnet_ping_check = False
if 'subnet' in config:
for subnet, subnet_config in config['subnet'].items():
if 'disable' in subnet_config:
continue
+
+ if 'ping_check' in subnet_config:
+ subnet_ping_check = True
+
network['subnet4'].append(kea_parse_subnet(subnet, subnet_config))
+ if 'ping_check' in config or subnet_ping_check:
+ network['user-context']['enable-ping-check'] = True
+
out.append(network)
return dumps(out, indent=4)
diff --git a/src/conf_mode/service_dhcp-server.py b/src/conf_mode/service_dhcp-server.py
index a1294d77e..c022d0a96 100755
--- a/src/conf_mode/service_dhcp-server.py
+++ b/src/conf_mode/service_dhcp-server.py
@@ -32,6 +32,7 @@ from vyos.pki import wrap_private_key
from vyos.template import render
from vyos.utils.dict import dict_search
from vyos.utils.dict import dict_search_args
+from vyos.utils.dict import dict_search_recursive
from vyos.utils.file import chmod_775
from vyos.utils.file import makedir
from vyos.utils.file import write_file
@@ -226,6 +227,9 @@ def get_config(config=None):
no_tag_node_value_mangle=True,
)
+ if bool(list(dict_search_recursive(dhcp, 'ping_check'))):
+ dhcp['any_ping_check'] = True
+
return dhcp
def verify_ddns_domain_servers(domain_type, domain):