mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_netif: Remove restarting DHCP client and server if it has already been started
To be in line with previous behaviour in tcpip_adapter, do nothing and return appropriate error if the DHCP client/server has already been started
This commit is contained in:
parent
9dbff45229
commit
39f804ae07
@ -916,6 +916,11 @@ static esp_err_t esp_netif_dhcpc_start_api(esp_netif_api_msg_t *msg)
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (esp_netif->dhcpc_status == ESP_NETIF_DHCP_STARTED) {
|
||||
ESP_LOGD(TAG, "dhcp client already started");
|
||||
return ESP_ERR_ESP_NETIF_DHCP_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
struct netif *p_netif = esp_netif->lwip_netif;
|
||||
|
||||
esp_netif_reset_ip_info(esp_netif);
|
||||
@ -985,6 +990,11 @@ static esp_err_t esp_netif_dhcps_start_api(esp_netif_api_msg_t *msg)
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (esp_netif->dhcps_status == ESP_NETIF_DHCP_STARTED) {
|
||||
ESP_LOGD(TAG, "dhcp server already started");
|
||||
return ESP_ERR_ESP_NETIF_DHCP_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
struct netif *p_netif = esp_netif->lwip_netif;
|
||||
if (p_netif != NULL && netif_is_up(p_netif)) {
|
||||
esp_netif_ip_info_t *default_ip = esp_netif->ip_info;
|
||||
|
Loading…
x
Reference in New Issue
Block a user