summaryrefslogtreecommitdiff
path: root/python
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 /python
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
Diffstat (limited to 'python')
-rw-r--r--python/vyos/kea.py2
-rwxr-xr-xpython/vyos/template.py12
2 files changed, 10 insertions, 4 deletions
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)