Commit 771484ac authored by Evan Hunt's avatar Evan Hunt
Browse files

Exit with warning when DHCPv6 config is used but -6 isn't specified [rt17334]

parent 0d394885
......@@ -55,6 +55,9 @@ suggested fixes to <dhcp-users@isc.org>.
Changes since 4.0.0
- Exit with warning when DHCPv6-specific statements are used in the
config file but -6 is not specified.
- It's now possible to update the "ends" field of a lease with OMAPI.
This is useful if you want not only to release a lease, but also make
it available for reuse right away. Hat tip to Christof Chen.
......
......@@ -373,6 +373,13 @@ parse_ip6_addr(struct parse *cfile, struct iaddr *addr) {
char v6[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
int v6_len;
if (local_family != AF_INET6) {
parse_warn(cfile, "IPv6 addresses are only available "
"in DHCPv6 mode.");
skip_to_semi(cfile);
return 0;
}
/*
* First token is non-raw. This way we eat any whitespace before
* our IPv6 address begins, like one would expect.
......
......@@ -2571,6 +2571,13 @@ parse_subnet6_declaration(struct parse *cfile, struct shared_network *share) {
0xF0, 0xF8, 0xFC, 0xFE };
struct iaddr iaddr;
if (local_family != AF_INET6) {
parse_warn(cfile, "subnet6 statement is only supported "
"in DHCPv6 mode.");
skip_to_semi(cfile);
return;
}
subnet = NULL;
status = subnet_allocate(&subnet, MDL);
if (status != ISC_R_SUCCESS) {
......@@ -3667,6 +3674,13 @@ parse_address_range6(struct parse *cfile, struct group *group) {
struct iaddrcidrnetlist *nets;
struct iaddrcidrnetlist *p;
if (local_family != AF_INET6) {
parse_warn(cfile, "range6 statement is only supported "
"in DHCPv6 mode.");
skip_to_semi(cfile);
return;
}
/*
* We'll use the shared_network from our group.
*/
......@@ -3841,6 +3855,12 @@ parse_ia_na_declaration(struct parse *cfile) {
struct binding *bnd;
struct binding_value *nv=NULL;
if (local_family != AF_INET6) {
parse_warn(cfile, "IA_NA is only supported in DHCPv6 mode.");
skip_to_semi(cfile);
return;
}
token = next_token(&val, &len, cfile);
if (token != STRING) {
parse_warn(cfile, "corrupt lease file; "
......@@ -4129,6 +4149,12 @@ parse_ia_ta_declaration(struct parse *cfile) {
struct binding *bnd;
struct binding_value *nv=NULL;
if (local_family != AF_INET6) {
parse_warn(cfile, "IA_TA is only supported in DHCPv6 mode.");
skip_to_semi(cfile);
return;
}
token = next_token(&val, &len, cfile);
if (token != STRING) {
parse_warn(cfile, "corrupt lease file; "
......@@ -4418,6 +4444,12 @@ parse_ia_pd_declaration(struct parse *cfile) {
struct binding *bnd;
struct binding_value *nv=NULL;
if (local_family != AF_INET6) {
parse_warn(cfile, "IA_PD is only supported in DHCPv6 mode.");
skip_to_semi(cfile);
return;
}
token = next_token(&val, &len, cfile);
if (token != STRING) {
parse_warn(cfile, "corrupt lease file; "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment