mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-17 16:26:59 +00:00
getdata & analyze: fix first_ip and last_ip arithmetics
There were too clever tricks done with first and last. Earlier the aim was to minimize '<=' and '>=' by fiddling with the numbers at the time when they were saved. While the program logic seemed to work there were some off by one mistakes, resulting to a count error. Even worse there is not even that many of such comparisons, so that one cannot really even justify added complexity. I really hope this patch is last this kind fix ever needed. Reported-by: Cheer Xiao <xiaqqaix@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
83e12457bc
commit
822ca33804
3 changed files with 29 additions and 27 deletions
|
|
@ -358,7 +358,7 @@ void parse_config(int is_include, const char *restrict config_file,
|
|||
range_p = ranges + num_ranges;
|
||||
inet_aton(word, &inp);
|
||||
argument = 0;
|
||||
range_p->last_ip = ntohl(inp.s_addr) + 1;
|
||||
range_p->last_ip = ntohl(inp.s_addr);
|
||||
range_p->count = 0;
|
||||
range_p->touched = 0;
|
||||
range_p->backups = 0;
|
||||
|
|
@ -383,7 +383,7 @@ void parse_config(int is_include, const char *restrict config_file,
|
|||
* again */
|
||||
break;
|
||||
}
|
||||
range_p->first_ip = ntohl(inp.s_addr) - 1;
|
||||
range_p->first_ip = ntohl(inp.s_addr);
|
||||
argument = 2;
|
||||
break;
|
||||
case 1:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue