Commit 0aa74669 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[master] Execute pool statements separately in dhcpinform()

    Merged 43291a.
parent 970d9b0b
...@@ -145,6 +145,7 @@ by Eric Young (eay@cryptsoft.com). ...@@ -145,6 +145,7 @@ by Eric Young (eay@cryptsoft.com).
Prior to this the server only evaluated options down to the subnet scope. Prior to this the server only evaluated options down to the subnet scope.
Thanks to Fernando Soto at BlueCat Networks for reporting the issue. Thanks to Fernando Soto at BlueCat Networks for reporting the issue.
[ISC-Bugs #43219] [ISC-Bugs #43219]
[ISC-Bugs #45051]
Changes since 4.3.0 (bug fixes) Changes since 4.3.0 (bug fixes)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
DHCP Protocol engine. */ DHCP Protocol engine. */
/* /*
* Copyright (c) 2004-2016 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
...@@ -1085,7 +1085,6 @@ void dhcpinform (packet, ms_nulltp) ...@@ -1085,7 +1085,6 @@ void dhcpinform (packet, ms_nulltp)
#if defined (DEBUG_INFORM_HOST) #if defined (DEBUG_INFORM_HOST)
int h_w_fixed_addr = 0; int h_w_fixed_addr = 0;
#endif #endif
struct lease* cip_lease = NULL;
/* The client should set ciaddr to its IP address, but apparently /* The client should set ciaddr to its IP address, but apparently
it's common for clients not to do this, so we'll use their IP it's common for clients not to do this, so we'll use their IP
...@@ -1232,22 +1231,32 @@ void dhcpinform (packet, ms_nulltp) ...@@ -1232,22 +1231,32 @@ void dhcpinform (packet, ms_nulltp)
maybe_return_agent_options(packet, options); maybe_return_agent_options(packet, options);
/* Execute statements network statements starting at the subnet level */
execute_statements_in_scope(NULL, packet, NULL, NULL,
packet->options, options,
&global_scope, subnet->group,
NULL, NULL);
/* If we have ciaddr, find its lease so we can find its pool. */ /* If we have ciaddr, find its lease so we can find its pool. */
if (zeroed_ciaddr == ISC_FALSE) { if (zeroed_ciaddr == ISC_FALSE) {
struct lease* cip_lease = NULL;
find_lease_by_ip_addr (&cip_lease, cip, MDL); find_lease_by_ip_addr (&cip_lease, cip, MDL);
}
/* Overlay with pool options if ciaddr mapped to a lease. */
if (cip_lease) {
if (cip_lease->pool && cip_lease->pool->group) {
execute_statements_in_scope(
NULL, packet, NULL, NULL,
packet->options, options,
&global_scope,
cip_lease->pool->group,
cip_lease->pool->shared_network->group,
NULL);
}
/* Execute statements starting at the pool scope if we can lease_dereference (&cip_lease, MDL);
* otherwise the subnet scope is a far as we can go. */ }
execute_statements_in_scope(NULL, packet, NULL, NULL,
packet->options, options,
&global_scope,
(cip_lease != NULL &&
cip_lease->pool != NULL ?
cip_lease->pool->group : subnet->group),
NULL, NULL);
if (cip_lease) {
lease_dereference (&cip_lease, MDL);
} }
/* Execute statements in the class scopes. */ /* Execute statements in the class scopes. */
......
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