mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_ipv6_nd6_issue_v3.1' into 'release/v3.1'
fix ipv6 nd6 issue.(backport v3.1) See merge request espressif/esp-idf!10532
This commit is contained in:
commit
aea29b01c8
@ -463,6 +463,20 @@ config TCPIP_TASK_STACK_SIZE
|
||||
Configure TCP/IP task stack size, used by LWIP to process multi-threaded TCP/IP operations.
|
||||
Setting this stack too small will result in stack overflow crashes.
|
||||
|
||||
config LWIP_IPV6_MEMP_NUM_ND6_QUEUE
|
||||
int "Max number of IPv6 packets to queue during MAC resolution"
|
||||
range 3 20
|
||||
default 3
|
||||
help
|
||||
Config max number of IPv6 packets to queue during MAC resolution.
|
||||
|
||||
config LWIP_IPV6_ND6_NUM_NEIGHBORS
|
||||
int "Max number of entries in IPv6 neighbor cache"
|
||||
range 3 10
|
||||
default 5
|
||||
help
|
||||
Config max number of entries in IPv6 neighbor cache
|
||||
|
||||
menuconfig PPP_SUPPORT
|
||||
bool "Enable PPP support (new/experimental)"
|
||||
default n
|
||||
|
@ -1636,6 +1636,12 @@ nd6_queue_packet(s8_t neighbor_index, struct pbuf * q)
|
||||
if (copy_needed) {
|
||||
/* copy the whole packet into new pbufs */
|
||||
p = pbuf_alloc(PBUF_LINK, q->tot_len, PBUF_RAM);
|
||||
#if ESP_ND6_QUEUEING
|
||||
if(p == NULL) {
|
||||
pbuf_free(q);
|
||||
return ERR_MEM;
|
||||
}
|
||||
#else
|
||||
while ((p == NULL) && (neighbor_cache[neighbor_index].q != NULL)) {
|
||||
/* Free oldest packet (as per RFC recommendation) */
|
||||
#if LWIP_ND6_QUEUEING
|
||||
@ -1655,6 +1661,7 @@ nd6_queue_packet(s8_t neighbor_index, struct pbuf * q)
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* referencing the old pbuf is enough */
|
||||
p = q;
|
||||
@ -1675,6 +1682,7 @@ nd6_queue_packet(s8_t neighbor_index, struct pbuf * q)
|
||||
new_entry = (struct nd6_q_entry *)memp_malloc(MEMP_ND6_QUEUE);
|
||||
}
|
||||
if (new_entry != NULL) {
|
||||
unsigned int qlen = 0;
|
||||
new_entry->next = NULL;
|
||||
new_entry->p = p;
|
||||
if (neighbor_cache[neighbor_index].q != NULL) {
|
||||
@ -1682,12 +1690,22 @@ nd6_queue_packet(s8_t neighbor_index, struct pbuf * q)
|
||||
r = neighbor_cache[neighbor_index].q;
|
||||
while (r->next != NULL) {
|
||||
r = r->next;
|
||||
qlen++;
|
||||
}
|
||||
r->next = new_entry;
|
||||
} else {
|
||||
/* queue did not exist, first item in queue */
|
||||
neighbor_cache[neighbor_index].q = new_entry;
|
||||
}
|
||||
#if ESP_ND6_QUEUEING
|
||||
if (qlen >= MEMP_NUM_ND6_QUEUE) {
|
||||
r->next = NULL;
|
||||
pbuf_free(new_entry->p);
|
||||
memp_free(MEMP_ND6_QUEUE, new_entry);
|
||||
LWIP_DEBUGF(LWIP_DBG_TRACE, ("ipv6: could not queue the packet %p (queue is full)\n", (void *)q));
|
||||
return ERR_MEM;
|
||||
}
|
||||
#endif
|
||||
LWIP_DEBUGF(LWIP_DBG_TRACE, ("ipv6: queued packet %p on neighbor entry %"S16_F"\n", (void *)p, (s16_t)neighbor_index));
|
||||
result = ERR_OK;
|
||||
} else {
|
||||
|
@ -2537,6 +2537,14 @@
|
||||
#define LWIP_ND6_QUEUEING (LWIP_IPV6)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ESP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address
|
||||
* is being resolved.
|
||||
*/
|
||||
#if !defined ESP_ND6_QUEUEING
|
||||
#define ESP_ND6_QUEUEING (LWIP_IPV6)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution.
|
||||
*/
|
||||
|
@ -633,6 +633,16 @@
|
||||
*/
|
||||
#define LWIP_IPV6 1
|
||||
|
||||
/**
|
||||
* MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution.
|
||||
*/
|
||||
#define MEMP_NUM_ND6_QUEUE CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE
|
||||
|
||||
/**
|
||||
* LWIP_ND6_NUM_NEIGHBORS: Number of entries in IPv6 neighbor cache
|
||||
*/
|
||||
#define LWIP_ND6_NUM_NEIGHBORS CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS
|
||||
|
||||
/*
|
||||
---------------------------------------
|
||||
---------- Hook options ---------------
|
||||
|
Loading…
Reference in New Issue
Block a user