#ifndef lint
static char copyright[] =
-"$Id: bootp.c,v 1.42 1999/03/30 18:12:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: bootp.c,v 1.43 1999/04/05 16:31:54 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
struct sockaddr_in to;
struct in_addr from;
struct hardware hto;
- struct option_state options;
+ struct option_state *options = (struct option_state *)0;
struct subnet *subnet;
struct lease *lease;
struct iaddr ip_address;
/* Run the executable statements to compute the client and server
options. */
-
- memset (&options, 0, sizeof options);
+ option_state_allocate (&options, "bootrequest");
/* Execute the subnet statements. */
- execute_statements_in_scope (packet, &options, &options,
+ execute_statements_in_scope (packet, options, options,
lease -> subnet -> group,
(struct group *)0);
/* Execute the host statements. */
- execute_statements_in_scope (packet, &options, &options, hp -> group,
+ execute_statements_in_scope (packet, options, options, hp -> group,
lease -> subnet -> group);
/* Drop the request if it's not allowed for this client. */
- if (evaluate_boolean_option_cache (packet, &options,
- lookup_option (options.dhcp_hash,
+ if (evaluate_boolean_option_cache (packet, options,
+ lookup_option (&dhcp_universe,
+ options,
SV_ALLOW_BOOTP))) {
log_info ("%s: bootp disallowed", msgbuf);
+ option_state_dereference (&options, "bootrequest");
return;
}
- if (evaluate_boolean_option_cache (packet, &options,
- lookup_option (options.dhcp_hash,
+ if (evaluate_boolean_option_cache (packet, options,
+ lookup_option (&dhcp_universe,
+ options,
SV_ALLOW_BOOTING))) {
log_info ("%s: booting disallowed", msgbuf);
+ option_state_dereference (&options, "bootrequest");
return;
}
name buffers. */
outgoing.packet_length =
- cons_options (packet, outgoing.raw, 0,
- &options, (struct agent_options *)0,
+ cons_options (packet, outgoing.raw, 0, options,
0, 0, 1, (struct data_string *)0);
if (outgoing.packet_length < BOOTP_MIN_LEN)
outgoing.packet_length = BOOTP_MIN_LEN;
raw.siaddr = (lease -> subnet -> shared_network ->
interface -> primary_address);
memset (&d1, 0, sizeof d1);
- oc = lookup_option (options.dhcp_hash, SV_NEXT_SERVER);
+ oc = lookup_option (&dhcp_universe, options, SV_NEXT_SERVER);
if (oc &&
- evaluate_option_cache (&d1, packet, &options, oc)) {
+ evaluate_option_cache (&d1, packet, options, oc)) {
/* If there was more than one answer, take the first. */
if (d1.len >= 4 && d1.data)
memcpy (&raw.siaddr, d1.data, 4);
raw.giaddr = packet -> raw -> giaddr;
/* Figure out the filename. */
- oc = lookup_option (options.dhcp_hash, SV_FILENAME);
+ oc = lookup_option (&dhcp_universe, options, SV_FILENAME);
if (oc &&
- evaluate_option_cache (&d1, packet, &options, oc)) {
+ evaluate_option_cache (&d1, packet, options, oc)) {
memcpy (raw.file, d1.data,
d1.len > sizeof raw.file ? sizeof raw.file : d1.len);
if (sizeof raw.file > d1.len)
memcpy (raw.file, packet -> raw -> file, sizeof raw.file);
/* Choose a server name as above. */
- oc = lookup_option (options.dhcp_hash, SV_SERVER_NAME);
+ oc = lookup_option (&dhcp_universe, options, SV_SERVER_NAME);
if (oc &&
- evaluate_option_cache (&d1, packet, &options, oc)) {
+ evaluate_option_cache (&d1, packet, options, oc)) {
memcpy (raw.sname, d1.data,
d1.len > sizeof raw.sname ? sizeof raw.sname : d1.len);
if (sizeof raw.sname > d1.len)
data_string_forget (&d1, "bootrequest");
}
+ /* We're done with the option state. */
+ option_state_dereference (&options, "bootrequest");
+
/* Set up the hardware destination address... */
hto.htype = packet -> raw -> htype;
hto.hlen = packet -> raw -> hlen;
#ifndef lint
static char copyright[] =
-"$Id: class.c,v 1.10 1999/03/16 05:50:42 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: class.c,v 1.11 1999/04/05 16:34:33 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
void classify_client (packet)
struct packet *packet;
{
- execute_statements (packet, &packet -> options,
+ execute_statements (packet, packet -> options,
(struct option_state *)0,
default_classification_rules);
}
class if we've already billed it to a different class. */
if (class -> submatch) {
status = evaluate_data_expression (&data, packet,
- &packet -> options,
+ packet -> options,
class -> submatch);
if (status) {
if ((nc = ((struct class *)
sizeof (struct lease *),
"check_collection"));
if (!nc -> billed_leases) {
- log_error ("no memory for billing");
+ log_error ("no memory for%s",
+ " billing");
data_string_forget
(&nc -> hash_string,
"check_collection");
}
status = (evaluate_boolean_expression_result
- (packet, &packet -> options, class -> expr));
+ (packet, packet -> options, class -> expr));
if (status) {
matched = 1;
#if defined (DEBUG_CLASS_MATCHING)