mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
analyze: a lot of IP counts being missed
Fix to a very severe bug. In cases when IP addresses in lease file had a range of using highest bit, e.g. signed int minus, the sort caused high ranges to be counted first and low ranges skipped. The usual case when this happen was when ranges contained 10.0.0.0/8 addresses together with addresses greater than 128.0.0.0/32. Reported-by: Ryan Malek <rmalek@osage.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
3c9226752b
commit
8f3d8ceae7
1 changed files with 5 additions and 1 deletions
|
|
@ -44,7 +44,11 @@
|
|||
/* Clean up data */
|
||||
int ip_sort(struct leases_t *a, struct leases_t *b)
|
||||
{
|
||||
return (a->ip - b->ip);
|
||||
if (a->ip < b->ip)
|
||||
return -1;
|
||||
if (a->ip > b->ip)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int prepare_data(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue