2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-01 06:45:27 +00:00

Pass parameter request list to cons_options.

This commit is contained in:
Ted Lemon
1999-03-10 20:39:22 +00:00
parent eeea13950a
commit ce0ec46d27
2 changed files with 22 additions and 28 deletions

View File

@@ -56,7 +56,7 @@
#ifndef lint
static char ocopyright[] =
"$Id: dhclient.c,v 1.57 1999/02/25 23:30:31 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: dhclient.c,v 1.58 1999/03/10 20:39:02 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -210,6 +210,9 @@ int main (argc, argv, envp)
/* Rewrite the lease database... */
rewrite_client_leases ();
/* XXX */
/* config_counter(&snd_counter, &rcv_counter); */
/* If no broadcast interfaces were discovered, call the script
and tell it so. */
if (!interfaces) {
@@ -1570,7 +1573,8 @@ void make_discover (client, lease)
/* Set up the option buffer... */
client -> packet_length =
cons_options ((struct packet *)0, &client -> packet, 0,
&options, (struct agent_options *)0, 0, 0, 0);
&options, (struct agent_options *)0,
0, 0, 0, (struct data_string *)0);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
@@ -1605,7 +1609,9 @@ void make_request (client, lease)
struct client_lease *lease;
{
unsigned char request = DHCPREQUEST;
int i;
int i, j;
unsigned char *tmp, *digest;
unsigned char *old_digest_loc;
struct option_state options;
struct option_cache *oc;
@@ -1628,7 +1634,8 @@ void make_request (client, lease)
/* Set up the option buffer... */
client -> packet_length =
cons_options ((struct packet *)0, &client -> packet, 0,
&options, (struct agent_options *)0, 0, 0, 0);
&options, (struct agent_options *)0,
0, 0, 0, (struct data_string *)0);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
@@ -1691,7 +1698,8 @@ void make_decline (client, lease)
/* Set up the option buffer... */
client -> packet_length =
cons_options ((struct packet *)0, &client -> packet, 0,
&options, (struct agent_options *)0, 0, 0, 0);
&options, (struct agent_options *)0,
0, 0, 0, (struct data_string *)0);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
@@ -1743,7 +1751,8 @@ void make_release (client, lease)
/* Set up the option buffer... */
client -> packet_length =
cons_options ((struct packet *)0, &client -> packet, 0,
&options, (struct agent_options *)0, 0, 0, 0);
&options, (struct agent_options *)0,
0, 0, 0, (struct data_string *)0);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;

View File

@@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: options.c,v 1.35 1999/02/24 17:56:46 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: options.c,v 1.36 1999/03/10 20:39:22 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
@@ -251,7 +251,7 @@ int parse_agent_information_option (packet, len, data)
of vendor options using the same routine. */
int cons_options (inpacket, outpacket, mms, options,
agent_options, overload, terminate, bootpp)
agent_options, overload, terminate, bootpp, prl)
struct packet *inpacket;
struct dhcp_packet *outpacket;
int mms;
@@ -260,6 +260,7 @@ int cons_options (inpacket, outpacket, mms, options,
int overload; /* Overload flags that may be set. */
int terminate;
int bootpp;
struct data_string *prl;
{
#define PRIORITY_COUNT 300
int priority_list [PRIORITY_COUNT];
@@ -325,27 +326,11 @@ int cons_options (inpacket, outpacket, mms, options,
priority_list [priority_len++] = DHO_DHCP_MESSAGE;
priority_list [priority_len++] = DHO_DHCP_REQUESTED_ADDRESS;
/* If the client has provided a list of options that it wishes
returned, use it to prioritize. Otherwise, prioritize
based on the default priority list. */
if (prl && prl -> len > 0) {
data_string_truncate (prl, (PRIORITY_COUNT - priority_len));
if (inpacket)
op = lookup_option (inpacket -> options.dhcp_hash,
DHO_DHCP_PARAMETER_REQUEST_LIST);
else
op = (struct option_cache *)0;
if (op)
evaluate_option_cache (&ds, inpacket,
&inpacket -> options, op);
if (ds.len > 0) {
data_string_truncate (&ds,
(PRIORITY_COUNT - priority_len));
for (i = 0; i < ds.len; i++)
priority_list [priority_len++] = ds.data [i];
data_string_forget (&ds, "cons_options");
for (i = 0; i < prl -> len; i++)
priority_list [priority_len++] = prl -> data [i];
} else {
/* First, hardcode some more options that ought to be
sent first... */