From 52fbeb46ad4c84c93a0630a83a14340e2a9d56a6 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Tue, 28 Jun 2011 23:50:36 -0400 Subject: [PATCH] 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. --- ndhc/arp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ndhc/arp.c b/ndhc/arp.c index 69d9f64..ce7086e 100644 --- a/ndhc/arp.c +++ b/ndhc/arp.c @@ -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: