get_current() reports incorrectly active
dirkvdplas opened this issue · comments
entrys in dhdpd.leases.txt
Hello,
I assume get_current() shows only active leases. This is not correct:
# overview of all leases for 10.31.222.207
x = leases.get()
for v in x:
... if '10.31.222.207' in v.ip:
... print(k,v.ip, v.active, v.binding_state, v.start, v.end, v.valid)
...
00:50:56:99:35:f6 10.31.222.207 True active 2021-06-17 07:46:43 2021-06-17 08:46:43 True
00:50:56:99:35:f6 10.31.222.207 True active 2021-06-17 07:46:43 2021-06-17 08:46:43 True
00:50:56:99:35:f6 10.31.222.207 False released 2021-06-17 07:46:43 2021-06-17 07:47:09 False
00:50:56:99:35:f6 10.31.222.207 False free 2021-06-17 07:46:43 2021-06-17 07:47:09 False
00:50:56:99:35:f6 10.31.222.207 False backup 2021-06-17 07:47:11 2021-06-17 07:47:09 False
00:50:56:99:35:f6 10.31.222.207 False backup 2021-06-17 07:47:11 2021-06-17 07:47:09 False
00:50:56:99:35:f6 10.31.222.207 False backup 2021-06-17 07:47:11 2021-06-17 07:47:09 False
overview of current leases for 10.31.222.207
a = leases.get_current()
for k,v in a.items():
... if '10.31.222.207' in v.ip:
... print(k,v.ip, v.active, v.binding_state, v.start, v.end, v.valid)
...
00:50:56:99:35:f6 10.31.222.207 True active 2021-06-17 07:46:43 2021-06-17 08:46:43 True`
``
As you can see with leases.get() the most recent lease is not active anymore, so my conclusion is that get_current provided wrong info. See alzo attached dhdpd.leases file
`
Can you improve the wording a bit? What is your expected outcome? As far as I can see get_current()
in your example (and in the code) is only returning one active & valid lease for each MAC.
Sorry for not being clear. Bases on output of get_current you would think that lease / binding_state is active , which is not true.
The output of leases.get() shows that binding_state is false.
Regards,
Dirk