Tolerate short DHCP messages that are less than DHCP_SIZE. The previous

check was overzealous and would drop valid packets.  Now the minimal
packet size that is tolerated is 32 bytes.

24 bytes would be enough for the client IP, but I very much doubt that any
server would leave out the non-optional fields of siaddr and giaddr as well as
chaddr. We already tolerate elided chaddr with a cut-off of 32 bytes, which is
dubious enough.
This commit is contained in:
Nicholas J. Kain 2011-06-10 14:04:50 -04:00
parent bd49819f28
commit 109dfd74c6

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-05-30 10:39:56 njk> * Time-stamp: <2011-06-10 13:56:28 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 < DHCP_SIZE) { if (len < 32) {
log_line("Received short DHCP packet -- ignoring"); log_line("Received DHCP packet with less than 32 chars -- ignoring");
return; return;
} }