mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-02 12:52:10 +00:00
fixed bug #34681 Limit ARP queue length by ARP_QUEUE_LEN (=3)
This commit is contained in:
parent
05a967564a
commit
07fbe82305
@ -96,6 +96,9 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2014-02-22: Simon Goldschmidt (patch by Amir Shalem)
|
||||||
|
* etharp.c, opt.h: fixed bug #34681 Limit ARP queue length by ARP_QUEUE_LEN (=3)
|
||||||
|
|
||||||
2014-02-22: Simon Goldschmidt (patch by Amir Shalem)
|
2014-02-22: Simon Goldschmidt (patch by Amir Shalem)
|
||||||
* etharp.h/.c: fixed bug #34682 Limit ARP request flood for unresolved entry
|
* etharp.h/.c: fixed bug #34682 Limit ARP request flood for unresolved entry
|
||||||
|
|
||||||
|
@ -481,6 +481,14 @@
|
|||||||
#define ARP_QUEUEING 0
|
#define ARP_QUEUEING 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** The maximum number of packets which may be queued for each
|
||||||
|
* unresolved address by other network layers. Defaults to 3, 0 means disabled.
|
||||||
|
* Old packets are dropped, new packets are queued.
|
||||||
|
*/
|
||||||
|
#ifndef ARP_QUEUE_LEN
|
||||||
|
#define ARP_QUEUE_LEN 3
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be
|
* ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be
|
||||||
* updated with the source MAC and IP addresses supplied in the packet.
|
* updated with the source MAC and IP addresses supplied in the packet.
|
||||||
|
@ -1140,20 +1140,32 @@ etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q)
|
|||||||
/* allocate a new arp queue entry */
|
/* allocate a new arp queue entry */
|
||||||
new_entry = (struct etharp_q_entry *)memp_malloc(MEMP_ARP_QUEUE);
|
new_entry = (struct etharp_q_entry *)memp_malloc(MEMP_ARP_QUEUE);
|
||||||
if (new_entry != NULL) {
|
if (new_entry != NULL) {
|
||||||
|
unsigned int qlen = 0;
|
||||||
new_entry->next = 0;
|
new_entry->next = 0;
|
||||||
new_entry->p = p;
|
new_entry->p = p;
|
||||||
if(arp_table[i].q != NULL) {
|
if(arp_table[i].q != NULL) {
|
||||||
/* queue was already existent, append the new entry to the end */
|
/* queue was already existent, append the new entry to the end */
|
||||||
struct etharp_q_entry *r;
|
struct etharp_q_entry *r;
|
||||||
r = arp_table[i].q;
|
r = arp_table[i].q;
|
||||||
|
qlen++;
|
||||||
while (r->next != NULL) {
|
while (r->next != NULL) {
|
||||||
r = r->next;
|
r = r->next;
|
||||||
|
qlen++;
|
||||||
}
|
}
|
||||||
r->next = new_entry;
|
r->next = new_entry;
|
||||||
} else {
|
} else {
|
||||||
/* queue did not exist, first item in queue */
|
/* queue did not exist, first item in queue */
|
||||||
arp_table[i].q = new_entry;
|
arp_table[i].q = new_entry;
|
||||||
}
|
}
|
||||||
|
#if ARP_QUEUE_LEN
|
||||||
|
if (qlen >= ARP_QUEUE_LEN) {
|
||||||
|
struct etharp_q_entry *old;
|
||||||
|
old = arp_table[i].q;
|
||||||
|
arp_table[i].q = arp_table[i].q->next;
|
||||||
|
pbuf_free(old->p);
|
||||||
|
memp_free(MEMP_ARP_QUEUE, old);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: queued packet %p on ARP entry %"S16_F"\n", (void *)q, (s16_t)i));
|
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: queued packet %p on ARP entry %"S16_F"\n", (void *)q, (s16_t)i));
|
||||||
result = ERR_OK;
|
result = ERR_OK;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user