From 2df9cd7262a76ae782c4acb0a3a2b3edb8573258 Mon Sep 17 00:00:00 2001 From: likewise Date: Thu, 6 May 2004 02:43:47 +0000 Subject: [PATCH] Exported etharp_request(). --- src/include/netif/etharp.h | 1 + src/netif/etharp.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/include/netif/etharp.h b/src/include/netif/etharp.h index 9b432cbd..6142922d 100644 --- a/src/include/netif/etharp.h +++ b/src/include/netif/etharp.h @@ -93,5 +93,6 @@ void etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, err_t etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q); err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q); +err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr); #endif /* __NETIF_ARP_H__ */ diff --git a/src/netif/etharp.c b/src/netif/etharp.c index 50388211..22caf27d 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -208,10 +208,10 @@ static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags) for (i = 0; i < ARP_TABLE_SIZE; ++i) { /* empty entry? */ - if ((empty == ARP_TABLE_SIZE) && arp_table[i].state == ETHARP_STATE_EMPTY)) { + if (arp_table[i].state == ETHARP_STATE_EMPTY) { LWIP_DEBUGF(ETHARP_DEBUG, ("find_entry: found empty entry %d\n", i)); /* remember first empty entry */ - empty = i; + if (empty == ARP_TABLE_SIZE) empty = i; } /* pending entry? */ else if (arp_table[i].state == ETHARP_STATE_PENDING) { @@ -701,7 +701,7 @@ err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q) result = etharp_request(struct netif *netif, struct ip_addr *ipaddr); /* find entry in ARP cache */ - i = find_entry(&arp_table[i].ipaddr, q?ETHARP_INSERT:0); + i = find_entry(&arp_table[i].ipaddr, q?ETHARP_CREATE:0); /* could not find or create entry? */ if (i < 0) return (err_t)i;