2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-01 14:55:30 +00:00

- A bug was repaired in subencapsulation support, where spaces separated

by empty spaces would not get included. [ISC-Bugs #16805]
This commit is contained in:
David Hankins
2007-04-12 16:15:31 +00:00
parent ecde99a330
commit 06211b4018
2 changed files with 57 additions and 28 deletions

View File

@@ -34,6 +34,9 @@ the README file.
which causes the server to abstain from performing updates on PTR which causes the server to abstain from performing updates on PTR
records. Thanks to a patch from Christof Chen at Allianz. records. Thanks to a patch from Christof Chen at Allianz.
- A bug was repaired in subencapsulation support, where spaces separated
by empty spaces would not get included.
Changes since 3.1.0a3 Changes since 3.1.0a3
- Some spelling fixes. - Some spelling fixes.

View File

@@ -34,7 +34,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: options.c,v 1.104 2007/04/11 02:04:39 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; "$Id: options.c,v 1.105 2007/04/12 16:15:31 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#define DHCP_OPTION_DATA #define DHCP_OPTION_DATA
@@ -664,13 +664,11 @@ int cons_options (inpacket, outpacket, lease, client_state,
} }
} }
/* Now go through all the universes for which options /* Put any spaces that are encapsulated on the list,
were set and see if there are encapsulations for * sort out wether they contain values later.
them; if there are, put the encapsulation options */
on the priority list as well. */
for (i = 0; i < cfg_options -> universe_count; i++) { for (i = 0; i < cfg_options -> universe_count; i++) {
if (cfg_options -> universes [i] && if (universes[i]->enc_opt &&
universes [i] -> enc_opt &&
priority_len < PRIORITY_COUNT && priority_len < PRIORITY_COUNT &&
universes [i] -> enc_opt -> universe == &dhcp_universe) universes [i] -> enc_opt -> universe == &dhcp_universe)
{ {
@@ -2218,7 +2216,10 @@ int option_space_encapsulate (result, packet, lease, client_state,
log_error("encapsulation requested for %s with no support.", log_error("encapsulation requested for %s with no support.",
name->data); name->data);
/* Attempt to store any 'E'ncapsulated options that have not yet been return status;
}
/* Attempt to store any 'E'ncapsulated options that have not yet been
* placed on the option buffer by the above (configuring a value in * placed on the option buffer by the above (configuring a value in
* the space over-rides any values in the child universe). * the space over-rides any values in the child universe).
* *
@@ -2233,19 +2234,36 @@ int option_space_encapsulate (result, packet, lease, client_state,
* functions would already have stored such a value), and encapsulates * functions would already have stored such a value), and encapsulates
* at least one option, append it. * at least one option, append it.
*/ */
static int
search_subencapsulation(struct data_string *result, struct packet *packet,
struct lease *lease, struct client_state *client_state,
struct option_state *in_options,
struct option_state *cfg_options,
struct binding_scope **scope,
struct universe *universe)
{
struct data_string sub;
struct universe *subu;
int i, status = 0;
memset(&sub, 0, sizeof(sub)); memset(&sub, 0, sizeof(sub));
for (i = 0 ; i < cfg_options->universe_count ; i++) { for (i = 0 ; i < cfg_options->universe_count ; i++) {
subu = universes[i]; subu = universes[i];
if (cfg_options->universes[i] != NULL &&
subu->enc_opt != NULL && if (subu == NULL)
subu->enc_opt->universe == u && log_fatal("Impossible condition at %s:%d.", MDL);
if (subu->enc_opt != NULL &&
subu->enc_opt->universe == universe &&
subu->enc_opt->format != NULL && subu->enc_opt->format != NULL &&
subu->enc_opt->format[0] == 'E' && subu->enc_opt->format[0] == 'E' &&
lookup_option(u, cfg_options, lookup_option(universe, cfg_options,
subu->enc_opt->code) == NULL && subu->enc_opt->code) == NULL &&
subu->encapsulate(&sub, packet, lease, client_state, subu->encapsulate(&sub, packet, lease, client_state,
in_options, cfg_options, scope, subu)) { in_options, cfg_options,
if (append_option(result, u, subu->enc_opt, &sub)) scope, subu)) {
if (append_option(result, universe,
subu->enc_opt, &sub))
status = 1; status = 1;
data_string_forget(&sub, MDL); data_string_forget(&sub, MDL);
@@ -2291,6 +2309,10 @@ int hashed_option_space_encapsulate (result, packet, lease, client_state,
} }
} }
if (search_subencapsulation(result, packet, lease, client_state,
in_options, cfg_options, scope, universe))
status = 1;
return status; return status;
} }
@@ -2627,6 +2649,10 @@ int linked_option_space_encapsulate (result, packet, lease, client_state,
status = 1; status = 1;
} }
if (search_subencapsulation(result, packet, lease, client_state,
in_options, cfg_options, scope, universe))
status = 1;
return status; return status;
} }