From 67e8b3bcaf272b1b4afba412eecdc6d380ddd2a8 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Thu, 22 Sep 2016 11:49:37 +0800 Subject: [PATCH] tcpip_adapter: set sta ip to IP_ADDR_ANY when sta disconnect from ap When sta is disconnected from AP, set sta ip to IP_ADDR_ANY to trigger lwip to clean up all TCP/UDP pcbs. --- components/tcpip_adapter/tcpip_adapter_lwip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/tcpip_adapter/tcpip_adapter_lwip.c b/components/tcpip_adapter/tcpip_adapter_lwip.c index 0f681d913..78fecf2cb 100644 --- a/components/tcpip_adapter/tcpip_adapter_lwip.c +++ b/components/tcpip_adapter/tcpip_adapter_lwip.c @@ -161,6 +161,9 @@ esp_err_t tcpip_adapter_down(tcpip_adapter_if_t tcpip_if) ip4_addr_set_zero(&esp_ip[tcpip_if].netmask); } + /* Modify ip address to trigger tcp/udp pcb cleanup */ + netif_set_addr(esp_netif[tcpip_if], IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY); + netif_set_down(esp_netif[tcpip_if]); }