From: Ted Lemon Date: Tue, 16 Sep 1997 18:15:25 +0000 (+0000) Subject: Only use 64-byte option buffer for BOOTP packets X-Git-Tag: NetBSD_1_3_Alpha~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb0a9b2a168c5b85729f5a0eabf4cd098cb4b73e;p=thirdparty%2Fdhcp.git Only use 64-byte option buffer for BOOTP packets --- diff --git a/common/options.c b/common/options.c index 068cf0602..68b67b881 100644 --- a/common/options.c +++ b/common/options.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: options.c,v 1.25 1997/06/02 22:32:05 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: options.c,v 1.26 1997/09/16 18:15:25 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #define DHCP_OPTION_DATA @@ -155,12 +155,13 @@ void parse_option_buffer (packet, buffer, length) three seperate buffers if needed. This allows us to cons up a set of vendor options using the same routine. */ -int cons_options (inpacket, outpacket, options, overload, terminate) +int cons_options (inpacket, outpacket, options, overload, terminate, bootpp) struct packet *inpacket; struct dhcp_packet *outpacket; struct tree_cache **options; int overload; /* Overload flags that may be set. */ int terminate; + int bootpp; { unsigned char priority_list [300]; int priority_len; @@ -171,10 +172,10 @@ int cons_options (inpacket, outpacket, options, overload, terminate) int length; /* If the client has provided a maximum DHCP message size, - use that. Otherwise, we use the default MTU size (576 bytes). */ - /* XXX Maybe it would be safe to assume that we can send a packet - to the client that's as big as the one it sent us, even if it - didn't specify a large MTU. */ + 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 (inpacket && inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].data) { main_buffer_size = (getUShort (inpacket -> options @@ -183,7 +184,9 @@ int cons_options (inpacket, outpacket, options, overload, terminate) /* Enforce a minimum packet size... */ if (main_buffer_size < (576 - DHCP_FIXED_LEN)) main_buffer_size = 576 - DHCP_FIXED_LEN; - } else + } else if (bootpp) + main_buffer_size = 64; + else main_buffer_size = 576 - DHCP_FIXED_LEN; /* Preload the option priority list with mandatory options. */