diff options
-rw-r--r-- | sbin/dhclient/dhclient.c | 8 | ||||
-rw-r--r-- | sbin/dhclient/dhcpd.h | 4 | ||||
-rw-r--r-- | sbin/dhclient/options.c | 34 |
3 files changed, 9 insertions, 37 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 59ef98cf280..43211880cf0 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.70 2005/07/07 16:24:24 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.71 2005/07/07 20:03:40 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1392,7 +1392,7 @@ make_discover(struct interface_info *ip, struct client_lease *lease) } /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + ip->client->packet_length = cons_options(&ip->client->packet, 0, options, 0, 0, 0, NULL, 0); if (ip->client->packet_length < BOOTP_MIN_LEN) ip->client->packet_length = BOOTP_MIN_LEN; @@ -1466,7 +1466,7 @@ make_request(struct interface_info *ip, struct client_lease * lease) } /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + ip->client->packet_length = cons_options(&ip->client->packet, 0, options, 0, 0, 0, NULL, 0); if (ip->client->packet_length < BOOTP_MIN_LEN) ip->client->packet_length = BOOTP_MIN_LEN; @@ -1535,7 +1535,7 @@ make_decline(struct interface_info *ip, struct client_lease *lease) } /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + ip->client->packet_length = cons_options(&ip->client->packet, 0, options, 0, 0, 0, NULL, 0); if (ip->client->packet_length < BOOTP_MIN_LEN) ip->client->packet_length = BOOTP_MIN_LEN; diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 980b060b0ec..38484c5791c 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.34 2005/07/07 16:24:24 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.35 2005/07/07 20:03:40 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> @@ -245,7 +245,7 @@ struct hash_table { /* External definitions... */ /* options.c */ -int cons_options(struct packet *, struct dhcp_packet *, int, +int cons_options(struct dhcp_packet *, int, struct option_data *, int, int, int, u_int8_t *, int); char *pretty_print_option(unsigned int, unsigned char *, int, int, int); diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c index ccbb6acfa09..a1301f47f0d 100644 --- a/sbin/dhclient/options.c +++ b/sbin/dhclient/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.16 2005/07/07 16:24:24 krw Exp $ */ +/* $OpenBSD: options.c,v 1.17 2005/07/07 20:03:40 krw Exp $ */ /* DHCP options parsing and reassembly. */ @@ -196,7 +196,7 @@ parse_option_buffer(struct packet *packet, * vendor options using the same routine. */ int -cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, +cons_options(struct dhcp_packet *outpacket, int mms, struct option_data *options, int overload, /* Overload flags that may be set. */ int terminate, int bootpp, u_int8_t *prl, int prl_len) @@ -205,22 +205,6 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, int priority_len, main_buffer_size, mainbufix, bufix; int option_size, length; - /* - * If the client has provided a maximum DHCP message size, use - * that; otherwise, if it's BOOTP, only 64 bytes; otherwise use - * up to the minimum IP MTU size (576 bytes). - * - * XXX if a BOOTP client specifies a max message size, we will - * honor it. - */ - if (!mms && - inpacket && - inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data && - (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >= - sizeof(u_int16_t))) - mms = getUShort( - inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data); - if (mms) main_buffer_size = mms - DHCP_FIXED_LEN; else if (bootpp) @@ -243,19 +227,7 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, * returned, use it to prioritize. Otherwise, prioritize based * on the default priority list. */ - if (inpacket && - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) { - int prlen = - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len; - if (prlen + priority_len > sizeof(priority_list)) - prlen = sizeof(priority_list) - priority_len; - - memcpy(&priority_list[priority_len], - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data, - prlen); - priority_len += prlen; - prl = priority_list; - } else if (prl) { + if (prl) { if (prl_len + priority_len > sizeof(priority_list)) prl_len = sizeof(priority_list) - priority_len; |