mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-03 11:29:42 +08:00
feat(lwip): Rebind UDP pcb when IP changed
1. Rebind the UDP pcb, which originally bind to non-zero IPv4 address, to the new IPv4 address when the IPv4 address of related netif is changed. 2. Rebind the TCP pcb, which is in listening status, to the new IPv4 address when IPv4 address of related netif is changed. Notice: Recompile some related libs due to netif.h changed. internal: f194dd34
This commit is contained in:
9
VERSION
9
VERSION
@ -1,13 +1,14 @@
|
||||
gwen:
|
||||
espconn: 730c7f0
|
||||
espnow: 1aafc07
|
||||
main: b2944d6
|
||||
main: 730c7f0
|
||||
mesh: 1aafc07
|
||||
net80211: 1aafc07
|
||||
net80211: 730c7f0
|
||||
pp: 1474356
|
||||
wpa: 1aafc07
|
||||
wpa: 730c7f0
|
||||
wps: 1aafc07
|
||||
|
||||
gitlab:
|
||||
lwip: 243eb8be
|
||||
lwip: 2235ad17
|
||||
driver: 7bee5263
|
||||
mbedtls: 1ac9f1f4
|
||||
|
@ -160,6 +160,10 @@ struct netif {
|
||||
/** pointer to next in linked list */
|
||||
struct netif *next;
|
||||
|
||||
#ifdef LWIP_ESP8266
|
||||
ip_addr_t last_ip_addr;
|
||||
#endif
|
||||
|
||||
/** IP address configuration in network byte order */
|
||||
ip_addr_t ip_addr;
|
||||
ip_addr_t netmask;
|
||||
|
BIN
lib/libespconn.a
BIN
lib/libespconn.a
Binary file not shown.
BIN
lib/liblwip.a
BIN
lib/liblwip.a
Binary file not shown.
BIN
lib/libmain.a
BIN
lib/libmain.a
Binary file not shown.
Binary file not shown.
BIN
lib/libwpa.a
BIN
lib/libwpa.a
Binary file not shown.
28
third_party/lwip/core/netif.c
vendored
28
third_party/lwip/core/netif.c
vendored
@ -395,16 +395,42 @@ netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr)
|
||||
}
|
||||
}
|
||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||
if (!ip_addr_isany(ipaddr)) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if ((!(ip_addr_isany(ipX_2_ip(&lpcb->local_ip)))) &&
|
||||
(ip_addr_cmp(ipX_2_ip(&lpcb->local_ip), &(netif->ip_addr)))) {
|
||||
(ip_addr_cmp(ipX_2_ip(&lpcb->local_ip), &(netif->last_ip_addr)))) {
|
||||
/* The PCB is listening to the old ipaddr and
|
||||
* is set to listen to the new one instead */
|
||||
ip_addr_set(ipX_2_ip(&lpcb->local_ip), ipaddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LWIP_UDP
|
||||
#ifdef LWIP_ESP8266
|
||||
if (ipaddr && (ip_addr_cmp(ipaddr, &(netif->ip_addr))) == 0) {
|
||||
if (!ip_addr_isany(ipaddr)) {
|
||||
struct udp_pcb* upcb;
|
||||
for (upcb = udp_pcbs; upcb != NULL; upcb = upcb->next) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (!ip_addr_isany(ipX_2_ip(&upcb->local_ip)) &&
|
||||
ip_addr_cmp(ipX_2_ip(&upcb->local_ip), &(netif->last_ip_addr))) {
|
||||
/* The PCB is bound to the old ipaddr and
|
||||
* is set to bound to the new one instead */
|
||||
ip_addr_set(ipX_2_ip(&upcb->local_ip), ipaddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ipaddr && !ip_addr_isany(ipaddr)) {
|
||||
ip_addr_set(&(netif->last_ip_addr), ipaddr);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
snmp_delete_ipaddridx_tree(netif);
|
||||
snmp_delete_iprteidx_tree(0,netif);
|
||||
/* set new IP address to netif */
|
||||
|
Reference in New Issue
Block a user