Fixed IPv6 support in safeboot (#21233)

This commit is contained in:
s-hadinger 2024-04-20 22:15:54 +02:00 committed by GitHub
parent bf47a1e51c
commit c4431eb6fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 9 additions and 43 deletions

View File

@ -14,6 +14,9 @@ All notable changes to this project will be documented in this file.
### Changed
### Fixed
- HASPmota `align` attribute and expand PNG cache
- LVGL restore `lv_palette` functions
- IPv6 support in safeboot
### Removed
@ -58,8 +61,6 @@ All notable changes to this project will be documented in this file.
- NeoPool hydrolysis unit for Hidrolife, Bionet and Generic device (#21098)
- M5Core2 LoRa868 module receive exception
- Fade out on CCT bulb with `SO92 1` (#21159)
- HASPmota `align` attribute and expand PNG cache
- LVGL restore `lv_palette` functions
### Removed
- Unused `#define MQTT_DATA_STRING` support

View File

@ -135,8 +135,6 @@ struct WIFI {
bool wifi_test_AP_TIMEOUT = false;
bool wifi_Test_Restart = false;
bool wifi_Test_Save_SSID2 = false;
// IPv6 support, not guarded with #if LWIP_IPV6 to avoid bloating code with ifdefs
bool ipv6_local_link_called = false; // did we already enable IPv6 Local-Link address, needs to be redone at each reconnect
} Wifi;
typedef struct {

View File

@ -208,7 +208,7 @@ void CmndWifiTest(void)
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP " %s " D_AS " %s ..."),
ssid_test, TasmotaGlobal.hostname);
WiFi.begin(ssid_test,pswd_test);
WiFiHelper::begin(ssid_test,pswd_test);
}
} else {
ResponseCmndChar(D_JSON_BUSY);

View File

@ -250,12 +250,12 @@ void WifiBegin(uint8_t flag, uint8_t channel) {
char stemp[40] = { 0 };
if (channel) {
WiFi.begin(SettingsText(SET_STASSID1 + Settings->sta_active), SettingsText(SET_STAPWD1 + Settings->sta_active), channel, Wifi.bssid);
WiFiHelper::begin(SettingsText(SET_STASSID1 + Settings->sta_active), SettingsText(SET_STAPWD1 + Settings->sta_active), channel, Wifi.bssid);
// Add connected BSSID and channel for multi-AP installations
char hex_char[18];
snprintf_P(stemp, sizeof(stemp), PSTR(" Channel %d BSSId %s"), channel, ToHex_P((unsigned char*)Wifi.bssid, 6, hex_char, sizeof(hex_char), ':'));
} else {
WiFi.begin(SettingsText(SET_STASSID1 + Settings->sta_active), SettingsText(SET_STAPWD1 + Settings->sta_active));
WiFiHelper::begin(SettingsText(SET_STASSID1 + Settings->sta_active), SettingsText(SET_STAPWD1 + Settings->sta_active));
}
delay(500);
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s%s " D_IN_MODE " %s " D_AS " %s..."),
@ -818,18 +818,6 @@ void WifiCheckIp(void) {
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI D_CHECKING_CONNECTION));
Wifi.counter = WIFI_CHECK_SEC;
#ifdef USE_IPV6
if (WL_CONNECTED == WiFi.status()) {
#ifdef ESP32
if (!Wifi.ipv6_local_link_called) {
WiFi.enableIPv6(true); // TODO
Wifi.ipv6_local_link_called = true;
// AddLog(LOG_LEVEL_DEBUG, PSTR("WIF: calling enableIPV6"));
}
#endif
}
#endif // USE_IPV6
if ((WL_CONNECTED == WiFi.status()) && WifiHasIP()) {
WifiSetState(1);
Wifi.counter = WIFI_CHECK_SEC;
@ -1091,7 +1079,7 @@ void WifiConnect(void)
{
if (!Settings->flag4.network_wifi) { return; }
#if defined(ESP32) && !defined(FIRMWARE_MINIMAL)
#ifdef ESP32
static bool wifi_event_registered = false;
if (!wifi_event_registered) {
WiFi.onEvent(WifiEvents); // register event listener only once
@ -1494,27 +1482,6 @@ void WifiEvents(arduino_event_t *event) {
}
break;
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
// workaround for the race condition in LWIP, see https://github.com/espressif/arduino-esp32/pull/9016#discussion_r1451774885
{
uint32_t i = 5; // try 5 times only
while (esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_STA)) != ESP_OK) {
delay(1);
if (i-- == 0) {
break;
}
}
}
// WiFi.enableIPv6();
// AddLog(LOG_LEVEL_DEBUG, PSTR("WIF: Received ARDUINO_EVENT_WIFI_STA_CONNECTED"));
Wifi.ipv6_local_link_called = false; // not sure if this is needed, make sure link-local is restored at each reconnect
break;
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
case ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE:
Wifi.ipv6_local_link_called = false;
break;
default:
break;
}

View File

@ -1941,7 +1941,7 @@ void HandleWifiConfiguration(void) {
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP " %s " D_AS " %s ..."),
SettingsText(SET_STASSID1), TasmotaGlobal.hostname);
WiFi.begin(SettingsText(SET_STASSID1), SettingsText(SET_STAPWD1));
WiFiHelper::begin(SettingsText(SET_STASSID1), SettingsText(SET_STAPWD1));
WebRestart(2);
} else {

View File

@ -377,7 +377,7 @@ void MESHstartNode(int32_t _channel, uint8_t _role){ //we need a running broker
#ifdef ESP8266 // for now only ESP8266, might be added for the ESP32 later
MESH.channel = _channel;
WiFi.mode(WIFI_STA);
WiFi.begin("", "", MESH.channel, nullptr, false); //fake connection attempt to set channel
WiFiHelper::begin("", "", MESH.channel, nullptr, false); //fake connection attempt to set channel
wifi_promiscuous_enable(1);
wifi_set_channel(MESH.channel);
wifi_promiscuous_enable(0);