From: Shawn Routhier Date: Sat, 2 Jul 2011 00:05:35 +0000 (+0000) Subject: Restore common/discover.c, common/options.c and server/dhcp.c X-Git-Tag: v4_3_0a1~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c850c0eec5f8a3210ad1aed248739bf9a993ec89;p=thirdparty%2Fdhcp.git Restore common/discover.c, common/options.c and server/dhcp.c as I mistakenly committed them to head instead of the ticket branch. --- diff --git a/common/discover.c b/common/discover.c index 1d8421928..07129e5dc 100644 --- a/common/discover.c +++ b/common/discover.c @@ -1403,16 +1403,12 @@ isc_result_t got_one (h) if (result == 0) return ISC_R_UNEXPECTED; - /* - * If we didn't at least get the fixed portion of the BOOTP - * packet, drop the packet. - * Previously we allowed packets with no sname or filename - * as we were aware of at least one client that did. But - * a bug caused short packets to not work and nobody has - * complained, it seems rational to tighten up that - * restriction. - */ - if (result < DHCP_FIXED_NON_UDP) + /* If we didn't at least get the fixed portion of the BOOTP + packet, drop the packet. We're allowing packets with no + sname or filename, because we're aware of at least one + client that sends such packets, but this definitely falls + into the category of being forgiving. */ + if (result < DHCP_FIXED_NON_UDP - DHCP_SNAME_LEN - DHCP_FILE_LEN) return ISC_R_UNEXPECTED; #if defined(IP_PKTINFO) && defined(IP_RECVPKTINFO) && defined(USE_V4_PKTINFO) diff --git a/common/options.c b/common/options.c index 2be933841..09c4cd029 100644 --- a/common/options.c +++ b/common/options.c @@ -592,8 +592,8 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, } else if (bootpp) { mb_size = 64; if (inpacket != NULL && - (inpacket->packet_length >= 64 + DHCP_FIXED_NON_UDP)) - mb_size = inpacket->packet_length - DHCP_FIXED_NON_UDP; + (inpacket->packet_length - DHCP_FIXED_LEN >= 64)) + mb_size = inpacket->packet_length - DHCP_FIXED_LEN; } else mb_size = DHCP_MIN_OPTION_LEN; diff --git a/server/dhcp.c b/server/dhcp.c index 5875bb1be..de27c1a93 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -2354,7 +2354,6 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) * giaddr. */ if (!packet->agent_options_stashed && - (packet->options != NULL) && packet->options->universe_count > agent_universe.index && packet->options->universes[agent_universe.index] != NULL) { oc = lookup_option (&server_universe, state -> options, @@ -4507,7 +4506,6 @@ maybe_return_agent_options(struct packet *packet, struct option_state *options) * by the user into the new state, not just give up. */ if (!packet->agent_options_stashed && - (packet->options != NULL) && packet->options->universe_count > agent_universe.index && packet->options->universes[agent_universe.index] != NULL && (options->universe_count <= agent_universe.index ||