mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
prevent ipv6 calling twice with Eth
This commit is contained in:
@@ -354,31 +354,39 @@ void NetworkSettingsService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info)
|
|||||||
setWiFiPowerOnRSSI();
|
setWiFiPowerOnRSSI();
|
||||||
}
|
}
|
||||||
#if ESP_IDF_VERSION_MAJOR < 5
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
WiFi.enableIpV6();
|
WiFi.enableIpV6(); // force ipv6
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ARDUINO_EVENT_ETH_CONNECTED:
|
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||||
#if ESP_IDF_VERSION_MAJOR < 5
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
ETH.enableIpV6();
|
ETH.enableIpV6(); // force ipv6
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// IPv6 specific
|
// IPv6 specific
|
||||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
|
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
|
||||||
case ARDUINO_EVENT_ETH_GOT_IP6:
|
|
||||||
#if !TASMOTA_SDK && ESP_IDF_VERSION_MAJOR < 5
|
#if !TASMOTA_SDK && ESP_IDF_VERSION_MAJOR < 5
|
||||||
if (emsesp::EMSESP::system_.ethernet_connected()) {
|
|
||||||
emsesp::EMSESP::logger().info("Local IPv6 (Eth) =%s", ETH.localIPv6().toString().c_str());
|
|
||||||
} else {
|
|
||||||
emsesp::EMSESP::logger().info("Local IPv6 (WiFi)=%s", WiFi.localIPv6().toString().c_str());
|
emsesp::EMSESP::logger().info("Local IPv6 (WiFi)=%s", WiFi.localIPv6().toString().c_str());
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
emsesp::EMSESP::logger().info("Local IPv6=%s", IPAddress(IPv6, (uint8_t *)info.got_ip6.ip6_info.ip.addr, 0).toString().c_str());
|
emsesp::EMSESP::logger().info("Local IPv6=%s", IPAddress(IPv6, (uint8_t *)info.got_ip6.ip6_info.ip.addr, 0).toString().c_str());
|
||||||
#endif
|
#endif
|
||||||
emsesp::EMSESP::system_.has_ipv6(true);
|
emsesp::EMSESP::system_.has_ipv6(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// IPv6 specific
|
||||||
|
// This a bug in arduino where this is triggered twice, so we prevent it
|
||||||
|
case ARDUINO_EVENT_ETH_GOT_IP6:
|
||||||
|
if (!emsesp::EMSESP::system_.has_ipv6()) {
|
||||||
|
#if !TASMOTA_SDK && ESP_IDF_VERSION_MAJOR < 5
|
||||||
|
emsesp::EMSESP::logger().info("Local IPv6 (Eth)=%s", ETH.localIPv6().toString().c_str());
|
||||||
|
#else
|
||||||
|
emsesp::EMSESP::logger().info("Local IPv6=%s", IPAddress(IPv6, (uint8_t *)info.got_ip6.ip6_info.ip.addr, 0).toString().c_str());
|
||||||
|
#endif
|
||||||
|
emsesp::EMSESP::system_.has_ipv6(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user