mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
getdata: make single address ranges work
The dhcpd.conf can contain single IP range definitions, such as range 10.20.30.40; and they must be understood similar way as the range definiton would have two IP's that are the same IP, e.g., range 10.20.30.40 10.20.30.40; Reported-by: Joey D. <jobewan@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
b24fc42ec8
commit
ffffbc96cc
1 changed files with 10 additions and 1 deletions
|
|
@ -205,7 +205,7 @@ void parse_config(int is_include, const char *restrict config_file,
|
|||
struct shared_network_t *restrict shared_p)
|
||||
{
|
||||
FILE *dhcpd_config;
|
||||
bool newclause = true, comment = false;
|
||||
bool newclause = true, comment = false, one_ip_range = false;
|
||||
int quote = 0, braces = 0, argument = ITS_NOTHING_INTERESTING;
|
||||
size_t i = 0;
|
||||
char *word;
|
||||
|
|
@ -268,10 +268,15 @@ void parse_config(int is_include, const char *restrict config_file,
|
|||
break;
|
||||
}
|
||||
if (comment == false
|
||||
&& argument != ITS_A_RANGE_FIRST_IP
|
||||
&& argument != ITS_A_RANGE_SECOND_IP
|
||||
&& argument != ITS_AN_INCLUCE) {
|
||||
newclause = true;
|
||||
i = 0;
|
||||
} else if (argument == ITS_A_RANGE_FIRST_IP) {
|
||||
one_ip_range = true;
|
||||
argument = ITS_A_RANGE_SECOND_IP;
|
||||
c = ' ';
|
||||
} else if (argument == ITS_A_RANGE_SECOND_IP) {
|
||||
/* Range ends to ; and this hair in code
|
||||
* make two ranges wrote together like...
|
||||
|
|
@ -368,6 +373,10 @@ void parse_config(int is_include, const char *restrict config_file,
|
|||
range_p = ranges + num_ranges;
|
||||
parse_ipaddr(word, &addr);
|
||||
argument = ITS_NOTHING_INTERESTING;
|
||||
if (one_ip_range == true) {
|
||||
one_ip_range = false;
|
||||
copy_ipaddr(&range_p->first_ip, &addr);
|
||||
}
|
||||
copy_ipaddr(&range_p->last_ip, &addr);
|
||||
range_p->count = 0;
|
||||
range_p->touched = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue