Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_current() reports incorrectly active #37

Open
dirkvdplas opened this issue Jun 17, 2021 · 2 comments
Open

get_current() reports incorrectly active #37

dirkvdplas opened this issue Jun 17, 2021 · 2 comments

Comments

@dirkvdplas
Copy link

dirkvdplas commented Jun 17, 2021

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
`

@andir
Copy link
Contributor

andir commented Jun 17, 2021

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.

@dirkvdplas
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants