Blob Blame Raw
From 817a0831c54f06dda2727fe1118e7a65181eb128 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:14 -0800
Subject: [PATCH] ISCSIUIO: Added fix for the ARP cache flush mechanism

The ARP cache table wasn't being flushed correctly due to a bug
in the time stamp comparison.  The same bug can also be observed
to find the oldest entry in the ARP cache table to override.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
 iscsiuio/src/uip/uip_arp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/iscsiuio/src/uip/uip_arp.c b/iscsiuio/src/uip/uip_arp.c
index f7a9594..a8de07f 100644
--- a/iscsiuio/src/uip/uip_arp.c
+++ b/iscsiuio/src/uip/uip_arp.c
@@ -112,7 +112,7 @@ void uip_arp_timer(void)
 	for (i = 0; i < UIP_ARPTAB_SIZE; ++i) {
 		tabptr = &arp_table[i];
 		if ((tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 &&
-		    arptime - tabptr->time >= UIP_ARP_MAXAGE)
+		    (u8_t)(arptime - tabptr->time) >= UIP_ARP_MAXAGE)
 			memset(tabptr->ipaddr, 0, 4);
 	}
 
@@ -165,8 +165,8 @@ static void uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr)
 		c = 0;
 		for (i = 0; i < UIP_ARPTAB_SIZE; ++i) {
 			tabptr = &arp_table[i];
-			if (arptime - tabptr->time > tmpage) {
-				tmpage = arptime - tabptr->time;
+			if ((u8_t)(arptime - tabptr->time) > tmpage) {
+				tmpage = (u8_t)(arptime - tabptr->time);
 				c = i;
 			}
 		}
-- 
1.8.3.1