mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
esp_netif: Fix dhcps state transitions
When the DHCP server is stopped before starting the netif, it should remain stopped -- as per compatibility with previous tcpip_adapter behavior
This commit is contained in:
parent
4b47e7e643
commit
acf5333b1e
@ -724,7 +724,7 @@ static esp_err_t esp_netif_start_api(esp_netif_api_msg_t *msg)
|
||||
}
|
||||
if (esp_netif->flags & ESP_NETIF_DHCP_SERVER) {
|
||||
#if ESP_DHCPS
|
||||
if (esp_netif->dhcps_status != ESP_NETIF_DHCP_STARTED) {
|
||||
if (esp_netif->dhcps_status == ESP_NETIF_DHCP_INIT) {
|
||||
if (p_netif != NULL && netif_is_up(p_netif)) {
|
||||
esp_netif_ip_info_t *default_ip = esp_netif->ip_info;
|
||||
ip4_addr_t lwip_ip;
|
||||
@ -743,9 +743,11 @@ static esp_err_t esp_netif_start_api(esp_netif_api_msg_t *msg)
|
||||
esp_netif->dhcps_status = ESP_NETIF_DHCP_INIT;
|
||||
return ESP_OK;
|
||||
}
|
||||
} else if (esp_netif->dhcps_status == ESP_NETIF_DHCP_STARTED) {
|
||||
ESP_LOGD(TAG, "DHCP server already started");
|
||||
return ESP_ERR_ESP_NETIF_DHCP_ALREADY_STARTED;
|
||||
}
|
||||
ESP_LOGD(TAG, "DHCP server already started");
|
||||
return ESP_ERR_ESP_NETIF_DHCP_ALREADY_STARTED;
|
||||
return ESP_OK;
|
||||
#else
|
||||
LOG_NETIF_DISABLED_AND_DO("DHCP Server", return ESP_ERR_NOT_SUPPORTED);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user