1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-18 19:22:22 +01:00
This commit is contained in:
J. Nick Koston
2025-09-14 09:17:24 -05:00
parent c1c4fabc28
commit 09a4d51120

View File

@@ -491,17 +491,18 @@ void EthernetComponent::finish_connect_() {
#if USE_NETWORK_IPV6 #if USE_NETWORK_IPV6
// Retry IPv6 link-local setup if it failed during initial connect // Retry IPv6 link-local setup if it failed during initial connect
// This handles the case where IPv6 setup failed in start_connect_() // This handles the case where IPv6 setup failed in start_connect_()
// due to the interface not being fully ready (timing issue). // because the interface was still down (e.g., cable unplugged).
// By now the interface is stable since we're in CONNECTED state. // By now we're in CONNECTED state so the interface is up.
if (!this->ipv6_setup_done_) { if (!this->ipv6_setup_done_) {
esp_err_t err = esp_netif_create_ip6_linklocal(this->eth_netif_); esp_err_t err = esp_netif_create_ip6_linklocal(this->eth_netif_);
if (err == ESP_OK) { if (err == ESP_OK) {
ESP_LOGD(TAG, "IPv6 link-local address created (retry succeeded)"); ESP_LOGD(TAG, "IPv6 link-local address created (retry succeeded)");
} }
// Always set the flag to prevent continuous retries // Always set the flag to prevent continuous retries
// If IPv6 setup fails here with the interface up and stable, it's likely // If IPv6 setup fails here with the interface up and stable, it's
// a persistent issue (IPv6 disabled at router, hardware limitation, etc.) // likely a persistent issue (IPv6 disabled at router, hardware
// that won't be resolved by further retries. The device continues to work with IPv4. // limitation, etc.) that won't be resolved by further retries.
// The device continues to work with IPv4.
this->ipv6_setup_done_ = true; this->ipv6_setup_done_ = true;
} }
#endif /* USE_NETWORK_IPV6 */ #endif /* USE_NETWORK_IPV6 */
@@ -569,7 +570,8 @@ void EthernetComponent::start_connect_() {
#if USE_NETWORK_IPV6 #if USE_NETWORK_IPV6
// Attempt to create IPv6 link-local address // Attempt to create IPv6 link-local address
// Note: this may fail with ESP_FAIL if the interface is not fully up yet, // Note: this may fail with ESP_FAIL if the interface is not fully up yet,
// which can happen after network interruptions. We'll retry in the CONNECTED state if it fails here. // which can happen after network interruptions. We'll retry in the
// CONNECTED state if it fails here.
err = esp_netif_create_ip6_linklocal(this->eth_netif_); err = esp_netif_create_ip6_linklocal(this->eth_netif_);
if (err != ESP_OK) { if (err != ESP_OK) {
if (err == ESP_ERR_ESP_NETIF_INVALID_PARAMS) { if (err == ESP_ERR_ESP_NETIF_INVALID_PARAMS) {