mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 07:33:11 +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
206b1f4631
commit
2694a409c6
@ -107,7 +107,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;
|
||||||
@ -188,7 +190,9 @@ free_entry(int i)
|
|||||||
#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 */
|
||||||
@ -224,11 +228,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) */
|
||||||
@ -478,7 +481,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