mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 14:11:02 +00:00
ETHARP_STATE_STABLE_REREQUESTING: no need for member 'netif' in 'struct etharp_entry' if we re-request only from etharp_output() and use etharp_tmr() to reset the state of such entries to ETHARP_STATE_STABLE: that way, we also only send one ARP request per ARP_TMR_INTERVAL, but only if the entry is really still used.
This commit is contained in:
parent
5983c1c5ff
commit
b65af6c572
@ -106,7 +106,9 @@ struct etharp_entry {
|
|||||||
struct pbuf *q;
|
struct pbuf *q;
|
||||||
#endif /* ARP_QUEUEING */
|
#endif /* ARP_QUEUEING */
|
||||||
ip_addr_t ipaddr;
|
ip_addr_t ipaddr;
|
||||||
|
#if LWIP_SNMP
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
struct eth_addr ethaddr;
|
struct eth_addr ethaddr;
|
||||||
u8_t state;
|
u8_t state;
|
||||||
u8_t ctime;
|
u8_t ctime;
|
||||||
@ -182,12 +184,14 @@ free_entry(int i)
|
|||||||
free_etharp_q(arp_table[i].q);
|
free_etharp_q(arp_table[i].q);
|
||||||
arp_table[i].q = NULL;
|
arp_table[i].q = NULL;
|
||||||
}
|
}
|
||||||
/* recycle entry for re-use */
|
/* recycle entry for re-use */
|
||||||
arp_table[i].state = ETHARP_STATE_EMPTY;
|
arp_table[i].state = ETHARP_STATE_EMPTY;
|
||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
/* for debugging, clean out the complete entry */
|
/* for debugging, clean out the complete entry */
|
||||||
arp_table[i].ctime = 0;
|
arp_table[i].ctime = 0;
|
||||||
|
#if LWIP_SNMP
|
||||||
arp_table[i].netif = NULL;
|
arp_table[i].netif = NULL;
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
ip_addr_set_zero(&arp_table[i].ipaddr);
|
ip_addr_set_zero(&arp_table[i].ipaddr);
|
||||||
arp_table[i].ethaddr = ethzero;
|
arp_table[i].ethaddr = ethzero;
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
@ -223,11 +227,10 @@ etharp_tmr(void)
|
|||||||
/* clean up entries that have just been expired */
|
/* clean up entries that have just been expired */
|
||||||
free_entry(i);
|
free_entry(i);
|
||||||
}
|
}
|
||||||
else if ((arp_table[i].ctime >= ARP_AGE_REREQUEST_USED) &&
|
else if (arp_table[i].state == ETHARP_STATE_STABLE_REREQUESTING) {
|
||||||
(arp_table[i].state == ETHARP_STATE_STABLE_REREQUESTING)) {
|
/* Reset state to stable, so that the next transmitted packet will
|
||||||
/* stable entry that is in use is about to expire: re-request it to
|
re-send an ARP request. */
|
||||||
prevent it from breaking communication when it expires */
|
arp_table[i].state = ETHARP_STATE_STABLE;
|
||||||
etharp_request(arp_table[i].netif, &arp_table[i].ipaddr);
|
|
||||||
}
|
}
|
||||||
#if ARP_QUEUEING
|
#if ARP_QUEUEING
|
||||||
/* still pending entry? (not expired) */
|
/* still pending entry? (not expired) */
|
||||||
@ -477,7 +480,9 @@ update_arp_entry(struct netif *netif, ip_addr_t *ipaddr, struct eth_addr *ethadd
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* record network interface */
|
/* record network interface */
|
||||||
|
#if LWIP_SNMP
|
||||||
arp_table[i].netif = netif;
|
arp_table[i].netif = netif;
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
/* insert in SNMP ARP index tree */
|
/* insert in SNMP ARP index tree */
|
||||||
snmp_insert_arpidx_tree(netif, &arp_table[i].ipaddr);
|
snmp_insert_arpidx_tree(netif, &arp_table[i].ipaddr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user