From: Ted Lemon Date: Wed, 10 Mar 1999 20:39:22 +0000 (+0000) Subject: Pass parameter request list to cons_options. X-Git-Tag: V3-ALPHA-19990315~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ce0ec46d2798488db61ffa9c5d1eb44afc840be9;p=thirdparty%2Fdhcp.git Pass parameter request list to cons_options. --- diff --git a/client/dhclient.c b/client/dhclient.c index 7016925f5..dc79de767 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -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; diff --git a/common/options.c b/common/options.c index 59fadc438..69c736bbc 100644 --- a/common/options.c +++ b/common/options.c @@ -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... */