mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
analyse: critical bug in the counting code
The problem is, that you simply count all lease occurrences in dhcpd.leases, but only the last ones for each ip address are valid. The lease file is more like a logfile of what has been done, than a real database. To fix the counting issue, I'm using a single hash (from uthash.h [1]) for the counting. This way only the last lease entry for each IP gets into my counting structure. When you remove the duplicates in prepare_data(), you don't have the information anymore, if the active lease entry or the free lease entry came last. Simply deleting each ip from the touches array, that is already in the leases array, gives you a big chance to count wrong. Another way of fixing this would be to not only store the ips in your arrays, but a structure containing the ip and a global lease entry counter. Then you could delete all entries except for the latest. [1] http://uthash.sourceforge.net/ Reported-by: Huangy Signed-off-by: Enno Grper <groepeen@cms.hu-berlin.de> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
3ef5d6c07f
commit
ae7747db87
10 changed files with 166 additions and 150 deletions
32
TODO
32
TODO
|
|
@ -1,32 +1,10 @@
|
|||
### Bugs
|
||||
|
||||
> 1. from huangyu: china,fujian province,fuzhou
|
||||
>
|
||||
> according to my observation, every lease,for example,ip
|
||||
> 192.168.0.123 perhaps appears many times in dhcpd.leases,but
|
||||
> only the last time's state is the final valid state of this ip
|
||||
> 192.168.0.123.
|
||||
>
|
||||
> No matter it appears how many times in dhcpd.leases,and no
|
||||
> matter it has how many different state in dhcpd.leases. no
|
||||
> matter it had been assigned to how many different mac-address.
|
||||
> As long as it's last appearance's binding state is free in
|
||||
> dhcpd.leases,then ,it's free,in other word,it's not active.
|
||||
>
|
||||
> and i notice that if a active lease time expired,dhcpd daemon
|
||||
> will set this lease's binding state from active to free
|
||||
> directly,without released state in this period.
|
||||
>
|
||||
> in other words, when a lease's binding state "active" follow by
|
||||
> "free",not follow by "released";dhcpd-pools still think it's
|
||||
> active.
|
||||
>
|
||||
> and another bug maybe is:
|
||||
>
|
||||
> i found dhcpd-pools didn't consider if the active lease's ends
|
||||
> time is passed so it would still think the lease is active even
|
||||
> if dhcpd daemon is stopped for a long time,the leases marked by
|
||||
> "active" state in lease_file has expired in fact.
|
||||
Reported-by: Huangyu: I found dhcpd-pools didn't consider if the
|
||||
active lease's ends time is passed so it would still think the
|
||||
lease is active even if dhcpd daemon is stopped for a long time,
|
||||
the leases marked by "active" state in lease_file has expired in
|
||||
fact.
|
||||
|
||||
### Feature requests
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue