summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Fort <nicolasfort1988@gmail.com>2023-11-27 14:28:43 +0000
committerNicolas Fort <nicolasfort1988@gmail.com>2023-11-27 14:28:43 +0000
commitda83b3f96dcedaa8e4d926d9f5bdc963abd9a813 (patch)
treed947a05950ff46c81866865c552ee384915ba1e2
parent6afd6eeb87a3a4ecbbd5aa9c67622d0b3c27721c (diff)
downloadvyos-1x-da83b3f96dcedaa8e4d926d9f5bdc963abd9a813.tar.gz
vyos-1x-da83b3f96dcedaa8e4d926d9f5bdc963abd9a813.zip
T5778: dhcp server: patch op-mode command <show dhcp server leases>. If *pool* empty, this means that lease was granted by fail-over server. Also fix issue that <show dhcp server leases state all> print nothing.
-rwxr-xr-xsrc/op_mode/dhcp.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py
index 77f38992b..dfed2e2ed 100755
--- a/src/op_mode/dhcp.py
+++ b/src/op_mode/dhcp.py
@@ -114,8 +114,9 @@ def _get_raw_server_leases(family='inet', pool=None, sorted=None, state=[]) -> l
data_lease['remaining'] = str(data_lease["remaining"]).split('.')[0]
# Do not add old leases
- if data_lease['remaining'] != '' and data_lease['pool'] in pool and data_lease['state'] != 'free':
- if not state or data_lease['state'] in state:
+ if data_lease['remaining'] != '' and data_lease['state'] != 'free':
+ if not state or data_lease['state'] in state or state == 'all':
+ data_lease['pool'] = 'Failover-Server' if data_lease['pool'] == '' else data_lease['pool']
data.append(data_lease)
# deduplicate