Tweak the minimum dhcp packet size to at least include the magic cookie

field.  In practice, packets lacking any options at all are still invalid,
but they will fail later in the validation, so that is fine.
This commit is contained in:
Nicholas J. Kain 2011-06-11 04:09:05 -04:00
parent 6222d6ec0b
commit 7c6b07ca75

View File

@ -1,5 +1,5 @@
/* packet.c - send and react to DHCP message packets /* packet.c - send and react to DHCP message packets
* Time-stamp: <2011-06-10 13:56:28 njk> * Time-stamp: <2011-06-11 04:07:56 njk>
* *
* (c) 2004-2011 Nicholas J. Kain <njkain at gmail dot com> * (c) 2004-2011 Nicholas J. Kain <njkain at gmail dot com>
* (c) 2001 Russ Dill <Russ.Dill@asu.edu> * (c) 2001 Russ Dill <Russ.Dill@asu.edu>
@ -328,8 +328,8 @@ void handle_packet(struct client_state_t *cs)
if (len < 0) if (len < 0)
return; return;
if (len < 32) { if (len < DHCP_SIZE - 308) {
log_line("Received DHCP packet with less than 32 chars -- ignoring"); log_line("Packet is too short to contain magic cookie -- ignoring");
return; return;
} }