Fix a problem where, when ndhc is waiting for an arp packet, an arp packet

is received that is discarded by ndhc's basic checks and provokes a busy
loop in the main program loop because epoll_wait() constantly sees data that
is never drained from the socket buffer since arp_offset exceeds the
maximum size of an ARP packet and would overflow the packet buffer.
This commit is contained in:
Nicholas J. Kain 2011-06-28 23:50:36 -04:00
parent d1f36cf75e
commit 52fbeb46ad

View File

@ -302,14 +302,15 @@ void handle_arp_response(struct client_state_t *cs)
arpreply_offset += r;
}
if (arpreply_offset < ARP_MSG_SIZE) {
log_warning("arp: Received short ARP message -- ignoring");
if (arpreply_offset < ARP_MSG_SIZE)
return;
if (!arp_validate(&arpreply)) {
arpreply_clear();
return;
}
if (!arp_validate(&arpreply))
return;
++arp_packet_num;
switch (cs->dhcpState) {
case DS_ARP_CHECK: