#ifndef lint
static char copyright[] =
-"$Id: clparse.c,v 1.20 1998/11/09 02:42:58 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
+"$Id: clparse.c,v 1.21 1998/11/11 07:48:23 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
top_level_config.requested_options = default_requested_options;
top_level_config.requested_lease = 7200;
+ top_level_config.on_receipt = new_group ("read_client_conf");
+ if (!top_level_config.on_receipt)
+ error ("no memory for top-level on_receipt group");
+
+ top_level_config.on_transmission = new_group ("read_client_conf");
+ if (!top_level_config.on_transmission)
+ error ("no memory for top-level on_transmission group");
+
if ((cfile = fopen (path_dhclient_conf, "r")) != NULL) {
do {
token = peek_token (&val, cfile);
switch (peek_token (&val, cfile)) {
case SEND:
- p = &config -> on_transmission;
+ p = &config -> on_transmission -> statements;
op = supersede_option_statement;
do_option:
token = next_token (&val, cfile);
return;
case DEFAULT:
- p = &config -> on_receipt;
+ p = &config -> on_receipt -> statements;
op = default_option_statement;
goto do_option;
case SUPERSEDE:
- p = &config -> on_receipt;
+ p = &config -> on_receipt -> statements;
op = supersede_option_statement;
goto do_option;
case APPEND:
- p = &config -> on_receipt;
+ p = &config -> on_receipt -> statements;
op = append_option_statement;
goto do_option;
case PREPEND:
- p = &config -> on_receipt;
+ p = &config -> on_receipt -> statements;
op = prepend_option_statement;
goto do_option;
skip_to_semi (cfile);
}
} else {
- if (!config -> on_receipt) {
- config -> on_receipt = stmt;
+ if (!config -> on_receipt -> statements) {
+ config -> on_receipt -> statements = stmt;
} else {
struct executable_statement *s;
- for (s = config -> on_receipt;
+ for (s = config -> on_receipt -> statements;
s -> next; s = s -> next)
;
s -> next = stmt;
"make_client_config")));
if (!client -> config)
error ("no memory for client config\n");
- memset (client -> config, 0,
- sizeof *(client -> config));
memcpy (client -> config, config, sizeof *config);
+ client -> config -> on_receipt =
+ clone_group (config -> on_receipt, "make_client_config");
+ client -> config -> on_transmission =
+ clone_group (config -> on_transmission, "make_client_config");
}
/* client-lease-statement :==
break;
}
for (client = ip -> client; client; client = client -> next)
- if (!strcmp (client -> name, val))
+ if (client -> name && !strcmp (client -> name, val))
break;
if (!client)
parse_warn ("lease specified for unknown pseudo.");
#ifndef lint
static char copyright[] =
-"$Id: dhclient.c,v 1.52 1998/11/09 02:43:23 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.53 1998/11/11 07:48:20 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
no_daemon = 1;
} else if (!strcmp (argv [i], "-D")) {
save_scripts = 1;
+ } else if (!strcmp (argv [i], "-pf")) {
+ if (++i == argc)
+ usage ();
+ path_dhclient_pid = argv [i];
+ } else if (!strcmp (argv [i], "-cf")) {
+ if (++i == argc)
+ usage ();
+ path_dhclient_conf = argv [i];
+ } else if (!strcmp (argv [i], "-lf")) {
+ if (++i == argc)
+ usage ();
+ path_dhclient_db = argv [i];
} else if (argv [i][0] == '-') {
usage ();
} else {
{
}
+int unbill_class (lease, class)
+ struct lease *lease;
+ struct class *class;
+{
+ return 0;
+}
+
/* Individual States:
*
* Each routine is called from the dhclient_state_machine() in one of
/* If we're not receptive to an offer right now, or if the offer
has an unrecognizable transaction id, then just drop it. */
if (!client ||
- ip -> client -> state != S_SELECTING ||
+ client -> state != S_SELECTING ||
(packet -> interface -> hw_address.hlen !=
packet -> raw -> hlen) ||
(memcmp (packet -> interface -> hw_address.haddr,
warn ("send_packet: %m");
}
-void make_client_options (client, lease, type, sid, rip, prl, statements,
+void make_client_options (client, lease, type, sid, rip, prl,
options)
struct client_state *client;
struct client_lease *lease;
struct option_cache *sid;
struct iaddr *rip;
u_int32_t *prl;
- struct executable_statement *statements;
struct option_state *options;
{
int i;
going to use oc again */
/* Run statements that need to be run on transmission. */
- if (statements)
- execute_statements ((struct packet *)0,
- &lease -> options, options, statements);
+ if (client -> config -> on_transmission)
+ execute_statements_in_scope
+ ((struct packet *)0, &lease -> options, options,
+ client -> config -> on_transmission,
+ (struct group *)0);
}
void make_discover (client, lease)
lease, &discover, (struct option_cache *)0,
lease ? &lease -> address : (struct iaddr *)0,
client -> config -> requested_options,
- client -> config -> on_transmission,
&options);
/* Set up the option buffer... */
? &lease -> address
: (struct iaddr *)0),
client -> config -> requested_options,
- client -> config -> on_transmission,
&options);
/* Set up the option buffer... */
DHO_DHCP_SERVER_IDENTIFIER);
make_client_options (client, lease, &decline, oc,
&lease -> address, (u_int32_t *)0,
- (struct executable_statement *)0, &options);
+ &options);
/* Set up the option buffer... */
client -> packet_length =
DHO_DHCP_SERVER_IDENTIFIER);
make_client_options (client, lease, &request, oc,
&lease -> address, (u_int32_t *)0,
- (struct executable_statement *)0, &options);
+ &options);
/* Set up the option buffer... */
client -> packet_length =
fprintf (scriptFile, "export %sserver_name\n", prefix);
}
- execute_statements ((struct packet *)0, &lease -> options,
- &lease -> options,
- client -> config -> on_receipt);
+ execute_statements_in_scope ((struct packet *)0, &lease -> options,
+ &lease -> options,
+ client -> config -> on_receipt,
+ (struct group *)0);
for (i = 0; i < OPTION_HASH_SIZE; i++) {
pair hp;