mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-18 21:03:17 +08:00
fix(tcpip_adapter): Fix dhcp pcb not free
This commit is contained in:
@ -117,6 +117,16 @@ static err_t _dhcp_release(struct tcpip_api_call_data *p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static err_t _dhcp_clean(struct tcpip_api_call_data *p)
|
||||||
|
{
|
||||||
|
struct tcpip_adapter_api_call_data *call = (struct tcpip_adapter_api_call_data *)p;
|
||||||
|
|
||||||
|
dhcp_stop(call->netif);
|
||||||
|
dhcp_cleanup(call->netif);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int tcpip_adapter_start_dhcp(struct netif *netif)
|
static int tcpip_adapter_start_dhcp(struct netif *netif)
|
||||||
{
|
{
|
||||||
struct tcpip_adapter_api_call_data call;
|
struct tcpip_adapter_api_call_data call;
|
||||||
@ -144,6 +154,15 @@ static int tcpip_adapter_release_dhcp(struct netif *netif)
|
|||||||
return tcpip_api_call(_dhcp_release, (struct tcpip_api_call_data *)&call);
|
return tcpip_api_call(_dhcp_release, (struct tcpip_api_call_data *)&call);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tcpip_adapter_clean_dhcp(struct netif *netif)
|
||||||
|
{
|
||||||
|
struct tcpip_adapter_api_call_data call;
|
||||||
|
|
||||||
|
call.netif = netif;
|
||||||
|
|
||||||
|
return tcpip_api_call(_dhcp_clean, (struct tcpip_api_call_data *)&call);
|
||||||
|
}
|
||||||
|
|
||||||
void tcpip_adapter_init(void)
|
void tcpip_adapter_init(void)
|
||||||
{
|
{
|
||||||
if (tcpip_inited == false) {
|
if (tcpip_inited == false) {
|
||||||
@ -273,6 +292,7 @@ esp_err_t tcpip_adapter_stop(tcpip_adapter_if_t tcpip_if)
|
|||||||
|
|
||||||
esp_close((int)esp_netif[tcpip_if]->state);
|
esp_close((int)esp_netif[tcpip_if]->state);
|
||||||
if (!netif_is_up(esp_netif[tcpip_if])) {
|
if (!netif_is_up(esp_netif[tcpip_if])) {
|
||||||
|
tcpip_adapter_clean_dhcp(esp_netif[tcpip_if]);
|
||||||
netif_remove(esp_netif[tcpip_if]);
|
netif_remove(esp_netif[tcpip_if]);
|
||||||
return ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY;
|
return ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user