From 09a4d51120cd3ab1095fa55d73c44c5479f0b56b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 14 Sep 2025 09:17:24 -0500 Subject: [PATCH] comments --- esphome/components/ethernet/ethernet_component.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/esphome/components/ethernet/ethernet_component.cpp b/esphome/components/ethernet/ethernet_component.cpp index 66c6701ea1..ece42279f0 100644 --- a/esphome/components/ethernet/ethernet_component.cpp +++ b/esphome/components/ethernet/ethernet_component.cpp @@ -491,17 +491,18 @@ void EthernetComponent::finish_connect_() { #if USE_NETWORK_IPV6 // Retry IPv6 link-local setup if it failed during initial connect // This handles the case where IPv6 setup failed in start_connect_() - // due to the interface not being fully ready (timing issue). - // By now the interface is stable since we're in CONNECTED state. + // because the interface was still down (e.g., cable unplugged). + // By now we're in CONNECTED state so the interface is up. if (!this->ipv6_setup_done_) { esp_err_t err = esp_netif_create_ip6_linklocal(this->eth_netif_); if (err == ESP_OK) { ESP_LOGD(TAG, "IPv6 link-local address created (retry succeeded)"); } // Always set the flag to prevent continuous retries - // If IPv6 setup fails here with the interface up and stable, it's likely - // a persistent issue (IPv6 disabled at router, hardware limitation, etc.) - // that won't be resolved by further retries. The device continues to work with IPv4. + // If IPv6 setup fails here with the interface up and stable, it's + // likely a persistent issue (IPv6 disabled at router, hardware + // limitation, etc.) that won't be resolved by further retries. + // The device continues to work with IPv4. this->ipv6_setup_done_ = true; } #endif /* USE_NETWORK_IPV6 */ @@ -569,7 +570,8 @@ void EthernetComponent::start_connect_() { #if USE_NETWORK_IPV6 // Attempt to create IPv6 link-local address // 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_); if (err != ESP_OK) { if (err == ESP_ERR_ESP_NETIF_INVALID_PARAMS) {