mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[WiFi] Fix continuous logs flood + fix check for no credentials
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "../../../src/Helpers/StringConverter.h"
|
||||
#include "../../../src/Helpers/StringGenerator_WiFi.h"
|
||||
|
||||
#include "../wifi/ESPEasyWifi.h"
|
||||
|
||||
#if defined(ESP8266)
|
||||
# include <ESP8266WiFi.h>
|
||||
#endif // if defined(ESP8266)
|
||||
@@ -73,15 +75,9 @@ WiFi_AP_Candidate::WiFi_AP_Candidate(uint8_t index_c, const String& ssid_c) :
|
||||
{
|
||||
_allBits = 0u;
|
||||
|
||||
const size_t ssid_length = ssid_c.length();
|
||||
|
||||
if ((ssid_length == 0) || equals(ssid_c, F("ssid"))) {
|
||||
return;
|
||||
if (validWiFiSSID(ssid_c)) {
|
||||
ssid = ssid_c;
|
||||
}
|
||||
|
||||
if (ssid_length > 32) { return; }
|
||||
|
||||
ssid = ssid_c;
|
||||
}
|
||||
|
||||
WiFi_AP_Candidate::WiFi_AP_Candidate(uint8_t networkItem) : index(0) {
|
||||
|
||||
@@ -79,14 +79,14 @@ String makeRFCCompliantName(const String& name, const char replaceChar, const ch
|
||||
return hostname;
|
||||
}
|
||||
|
||||
void CheckRunningServices() {
|
||||
void CheckRunningServices(bool force) {
|
||||
// First try to get the time, since that may be used in logs
|
||||
if (Settings.UseNTP() && (node_time.getTimeSource() > timeSource_t::NTP_time_source)) {
|
||||
node_time.lastNTPSyncTime_ms = 0;
|
||||
node_time.initTime();
|
||||
}
|
||||
#if FEATURE_ESPEASY_P2P
|
||||
updateUDPport(true);
|
||||
updateUDPport(force);
|
||||
#endif
|
||||
|
||||
#if FEATURE_WIFI
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "../../ESPEasy_common.h"
|
||||
|
||||
#include "../net/DataStructs/MAC_address.h"
|
||||
#include "../net/DataTypes/NetworkIndex.h"
|
||||
|
||||
#include <IPAddress.h>
|
||||
|
||||
@@ -23,6 +24,9 @@ namespace net {
|
||||
|
||||
void setNetworkMedium(NetworkMedium_t medium);
|
||||
|
||||
|
||||
ESPEasy::net::networkIndex_t getNetworkIndex_defaultNetwork();
|
||||
|
||||
// void NetworkConnectRelaxed();
|
||||
bool NetworkConnected(bool force = false);
|
||||
IPAddress NetworkLocalIP();
|
||||
@@ -63,7 +67,7 @@ MAC_address WifiSoftAPmacAddress();
|
||||
MAC_address WifiSTAmacAddress();
|
||||
#endif // if FEATURE_WIFI
|
||||
|
||||
void CheckRunningServices();
|
||||
void CheckRunningServices(bool force = false);
|
||||
|
||||
#if FEATURE_ETHERNET
|
||||
bool EthFullDuplex();
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
#include "../net/ESPEasyNetwork.h"
|
||||
|
||||
#include "../../ESPEasy/net/Globals/NetworkState.h"
|
||||
#include "../net/Globals/NetworkState.h"
|
||||
#include "../net/eth/ESPEasyEth.h"
|
||||
#include "../net/Globals/NWPlugins.h"
|
||||
#include "../../src/ESPEasyCore/ESPEasy_Log.h"
|
||||
#include "../../src/Helpers/NetworkStatusLED.h"
|
||||
#include "../../src/Helpers/StringConverter.h"
|
||||
#include "../net/eth/ESPEasyEth.h"
|
||||
#include "../net/Globals/NWPlugins.h"
|
||||
#include "../../src/Globals/Settings.h"
|
||||
|
||||
|
||||
#include <NetworkManager.h>
|
||||
|
||||
@@ -116,6 +118,29 @@ NetworkInterface* getDefaultNonAP_interface()
|
||||
return network_if;
|
||||
}
|
||||
|
||||
ESPEasy::net::networkIndex_t getNetworkIndex_defaultNetwork()
|
||||
{
|
||||
auto network_if = getDefaultNonAP_interface();
|
||||
if (network_if == nullptr) {
|
||||
return ESPEasy::net::INVALID_NETWORK_INDEX;
|
||||
}
|
||||
for (ESPEasy::net::networkIndex_t x = 0; x < NETWORK_MAX; ++x) {
|
||||
if (Settings.getNetworkEnabled(x)) {
|
||||
struct EventStruct TempEvent;
|
||||
TempEvent.NetworkIndex = x;
|
||||
String str;
|
||||
|
||||
if (ESPEasy::net::NWPluginCall(NWPlugin::Function::NWPLUGIN_GET_INTERFACE, &TempEvent, str))
|
||||
{
|
||||
if (TempEvent.networkInterface->netif() == network_if->netif()) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ESPEasy::net::INVALID_NETWORK_INDEX;
|
||||
}
|
||||
|
||||
bool NetworkConnected(bool force) {
|
||||
static bool last_result = false;
|
||||
static uint32_t last_check_millis = 0;
|
||||
|
||||
@@ -56,6 +56,12 @@ void setNetworkMedium(NetworkMedium_t new_medium) {
|
||||
// ESPEasy::net::wifi::WiFiConnectRelaxed();
|
||||
// }
|
||||
|
||||
ESPEasy::net::networkIndex_t getNetworkIndex_defaultNetwork()
|
||||
{
|
||||
if (NetworkConnected()) return NETWORK_INDEX_WIFI_STA;
|
||||
return ESPEasy::net::INVALID_NETWORK_INDEX;
|
||||
}
|
||||
|
||||
bool NetworkConnected(bool force) {
|
||||
static bool last_result = false;
|
||||
static uint32_t last_check_millis = 0;
|
||||
|
||||
@@ -181,7 +181,7 @@ bool NWPluginCall(NWPlugin::Function Function, EventStruct *event, String& str)
|
||||
}
|
||||
|
||||
if (Function == NWPlugin::Function::NWPLUGIN_PRIORITY_ROUTE_CHANGED) {
|
||||
CheckRunningServices();
|
||||
CheckRunningServices(success);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
@@ -153,7 +153,12 @@ void ESPEasyWiFi_t::loop()
|
||||
// && !WiFiEventData.warnedNoValidWiFiSettings
|
||||
)
|
||||
{
|
||||
addLog(LOG_LEVEL_ERROR, F("WIFI : No valid wifi settings"));
|
||||
// Check for whether No Valid WiFi settings was already logged
|
||||
static uint32_t lastTimeLoggedNoWiFiCredentials = 0;
|
||||
if (timePassedSince(lastTimeLoggedNoWiFiCredentials) > 5000) {
|
||||
addLog(LOG_LEVEL_ERROR, F("WIFI : No valid wifi settings"));
|
||||
lastTimeLoggedNoWiFiCredentials = millis();
|
||||
}
|
||||
|
||||
// WiFiEventData.warnedNoValidWiFiSettings = true;
|
||||
}
|
||||
@@ -657,6 +662,7 @@ bool ESPEasyWiFi_t::shouldStartAP_fallback() const
|
||||
|
||||
bool ESPEasyWiFi_t::shouldRedirectTo_setup() const
|
||||
{
|
||||
if (!Settings.ApCaptivePortal()) return false;
|
||||
if (Settings.StartAPfallback_NoCredentials() && !SecuritySettings.hasWiFiCredentials()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
# include "../../../src/Helpers/ESPEasy_time_calc.h"
|
||||
# include "../../../src/Helpers/StringConverter.h"
|
||||
|
||||
#if FEATURE_TASKVALUE_UNIT_OF_MEASURE
|
||||
# include "../../../src/Helpers/ESPEasy_UnitOfMeasure.h"
|
||||
#endif
|
||||
# if FEATURE_TASKVALUE_UNIT_OF_MEASURE
|
||||
# include "../../../src/Helpers/ESPEasy_UnitOfMeasure.h"
|
||||
# endif
|
||||
|
||||
#ifdef ESP8266
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
#include "../../../src/Helpers/StringGenerator_WiFi.h"
|
||||
#endif
|
||||
#endif
|
||||
# ifdef ESP8266
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
# include "../../../src/Helpers/StringGenerator_WiFi.h"
|
||||
# endif
|
||||
# endif // ifdef ESP8266
|
||||
|
||||
# ifdef ESP32
|
||||
# include <WiFiGeneric.h>
|
||||
@@ -101,6 +101,34 @@ namespace wifi {
|
||||
- Connection stable (connected for > 5 minutes)
|
||||
|
||||
*/
|
||||
bool validWiFiSSID(const String& ssid) {
|
||||
// Can be any char upto 32 characters not being a null-char.
|
||||
// Some implementations, like Cisco, suggest some invalid characters:
|
||||
// - '+'
|
||||
// - ']'
|
||||
// - '/'
|
||||
// - '*'
|
||||
// - TAB
|
||||
// - Trailing spaces
|
||||
// And the first character cannot contain:
|
||||
// - '!'
|
||||
// - '#'
|
||||
// - ';'
|
||||
// Source: https://community.cisco.com/t5/networking-knowledge-base/characteristics-of-ssids/ta-p/3131765
|
||||
//
|
||||
// However this seems to be Cisco specific and not a limitation of the standard
|
||||
if (ssid.length() > 32) { return false; }
|
||||
|
||||
// "ssid" is an internal ESPEasy limitation, to signal an 'unset' value.
|
||||
return !ssid.isEmpty() && !ssid.equalsIgnoreCase(F("ssid"));
|
||||
}
|
||||
|
||||
bool validWiFiCredentials(const String& ssid, const String& pass) {
|
||||
if (!validWiFiSSID(ssid)) { return false; }
|
||||
const auto pass_length = pass.length();
|
||||
return (pass_length >= 8 && pass_length <= 63)
|
||||
|| pass_length == 0; // Empty password is possible
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// Check WiFi connected status
|
||||
@@ -158,19 +186,15 @@ void resetWiFi() {
|
||||
*/
|
||||
}
|
||||
|
||||
void initWiFi() { ESPEasyWiFi.setup(); }
|
||||
void initWiFi() { ESPEasyWiFi.setup(); }
|
||||
|
||||
void exitWiFi() { ESPEasyWiFi.disable(); }
|
||||
void exitWiFi() { ESPEasyWiFi.disable(); }
|
||||
|
||||
void loopWiFi() { ESPEasyWiFi.loop(); }
|
||||
void loopWiFi() { ESPEasyWiFi.loop(); }
|
||||
|
||||
bool shouldStartAP_fallback() {
|
||||
return ESPEasyWiFi.shouldStartAP_fallback();
|
||||
}
|
||||
bool shouldStartAP_fallback() { return ESPEasyWiFi.shouldStartAP_fallback(); }
|
||||
|
||||
bool shouldRedirectTo_setup() {
|
||||
return ESPEasyWiFi.shouldRedirectTo_setup();
|
||||
}
|
||||
bool shouldRedirectTo_setup() { return ESPEasyWiFi.shouldRedirectTo_setup(); }
|
||||
|
||||
# ifdef BOARD_HAS_SDIO_ESP_HOSTED
|
||||
|
||||
@@ -229,13 +253,14 @@ String GetHostedFwVersion(EspHostTypes hostType)
|
||||
String GetHostedMCU()
|
||||
{
|
||||
// Function is not yet implemented in Arduino Core so emulate it here
|
||||
#if defined(CONFIG_ESP_HOSTED_CP_TARGET_ESP32C6) && CONFIG_ESP_HOSTED_CP_TARGET_ESP32C6==1
|
||||
# if defined(CONFIG_ESP_HOSTED_CP_TARGET_ESP32C6) && CONFIG_ESP_HOSTED_CP_TARGET_ESP32C6 == 1
|
||||
return String("ESP32-C6");
|
||||
#else
|
||||
# else
|
||||
|
||||
if (equals(F(CONFIG_ESP_HOSTED_IDF_SLAVE_TARGET), F("esp32c6"))) {
|
||||
return String("ESP32-C6");
|
||||
}
|
||||
#endif
|
||||
# endif // if defined(CONFIG_ESP_HOSTED_CP_TARGET_ESP32C6) && CONFIG_ESP_HOSTED_CP_TARGET_ESP32C6 == 1
|
||||
return String("Unknown");
|
||||
}
|
||||
|
||||
@@ -313,9 +338,9 @@ bool write_WiFi_Hosted_MCU_pins(KeyValueWriter*writer)
|
||||
writer->write(kv);
|
||||
} else {
|
||||
KeyValueStruct freq(F("SDIO Freq"), psdio_config->clock_freq_khz / 1000);
|
||||
#if FEATURE_TASKVALUE_UNIT_OF_MEASURE
|
||||
# if FEATURE_TASKVALUE_UNIT_OF_MEASURE
|
||||
freq.setUnit(UOM_MHz);
|
||||
#endif
|
||||
# endif
|
||||
writer->write(freq);
|
||||
writer->write({ F("SDIO D0"), psdio_config->pin_d0.pin });
|
||||
writer->write({ F("SDIO D1"), psdio_config->pin_d1.pin });
|
||||
@@ -324,9 +349,10 @@ bool write_WiFi_Hosted_MCU_pins(KeyValueWriter*writer)
|
||||
writer->write({ F("SDIO CLK"), psdio_config->pin_clk.pin });
|
||||
writer->write({ F("SDIO CMD"), psdio_config->pin_cmd.pin });
|
||||
writer->write({ F("SDIO RST"), psdio_config->pin_reset.pin });
|
||||
|
||||
// Hide TX/RX queue size for now as it is unclear what these mean
|
||||
//writer->write({ F("SDIO TX queue"), psdio_config->tx_queue_size });
|
||||
//writer->write({ F("SDIO RX queue"), psdio_config->rx_queue_size });
|
||||
// writer->write({ F("SDIO TX queue"), psdio_config->tx_queue_size });
|
||||
// writer->write({ F("SDIO RX queue"), psdio_config->rx_queue_size });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ namespace wifi {
|
||||
# define WIFI_SCAN_INTERVAL_AP_USED 125000 // in milliSeconds
|
||||
# define WIFI_SCAN_INTERVAL_MINIMAL 60000 // in milliSeconds
|
||||
|
||||
bool validWiFiSSID(const String& ssid);
|
||||
|
||||
bool validWiFiCredentials(const String& ssid, const String& pass);
|
||||
|
||||
|
||||
bool WiFiConnected();
|
||||
|
||||
|
||||
@@ -167,7 +167,15 @@ bool doSetAPinternal(bool enable)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Settings.ApCaptivePortal()) {
|
||||
if (ESPEasy::net::wifi::shouldRedirectTo_setup()) {
|
||||
# if FEATURE_DNS_SERVER
|
||||
|
||||
if (dnsServerActive) {
|
||||
dnsServerActive = false;
|
||||
dnsServer.stop();
|
||||
}
|
||||
# endif // if FEATURE_DNS_SERVER
|
||||
|
||||
# ifdef ESP32
|
||||
# if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "../Globals/SecuritySettings.h"
|
||||
|
||||
#include "../../ESPEasy/net/wifi/ESPEasyWifi.h"
|
||||
|
||||
|
||||
SecurityStruct::SecurityStruct() {
|
||||
ZERO_FILL(WifiSSID);
|
||||
@@ -90,10 +92,12 @@ bool SecurityStruct::hasWiFiCredentials() const {
|
||||
}
|
||||
|
||||
bool SecurityStruct::hasWiFiCredentials(SecurityStruct::WiFiCredentialsSlot slot) const {
|
||||
|
||||
|
||||
if (slot == SecurityStruct::WiFiCredentialsSlot::first)
|
||||
return (WifiSSID[0] != 0 && !String(WifiSSID).equalsIgnoreCase(F("ssid")));
|
||||
return ESPEasy::net::wifi::validWiFiSSID(WifiSSID);
|
||||
if (slot == SecurityStruct::WiFiCredentialsSlot::second)
|
||||
return (WifiSSID2[0] != 0 && !String(WifiSSID2).equalsIgnoreCase(F("ssid")));
|
||||
return ESPEasy::net::wifi::validWiFiSSID(WifiSSID2);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#if FEATURE_STORE_CREDENTIALS_SEPARATE_FILE
|
||||
|
||||
# include "../../ESPEasy/net/wifi/ESPEasyWifi.h"
|
||||
|
||||
int SecurityStruct_deviceSpecific::maxLength(KeyType keyType)
|
||||
{
|
||||
switch (keyType)
|
||||
@@ -75,19 +77,83 @@ bool SecurityStruct_deviceSpecific::hasWiFiCredentials() const
|
||||
{
|
||||
for (uint8_t i = 0; i < MAX_EXTRA_WIFI_CREDENTIALS_SEPARATE_FILE; ++i)
|
||||
{
|
||||
if (hasWiFiCredentials(i)) return true;
|
||||
if (hasWiFiCredentials(i)) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SecurityStruct_deviceSpecific::hasWiFiCredentials(uint8_t index) const
|
||||
{
|
||||
if (index >= MAX_EXTRA_WIFI_CREDENTIALS_SEPARATE_FILE) { return false; }
|
||||
String ssid, pass;
|
||||
|
||||
if (!_kvs.getValue(createKey(KeyType::WiFi_SSID, index), ssid, KVS_StorageType::Enum::string_type) ||
|
||||
!_kvs.getValue(createKey(KeyType::WiFi_Password, index), pass, KVS_StorageType::Enum::string_type)) {
|
||||
return false;
|
||||
}
|
||||
return ESPEasy::net::wifi::validWiFiCredentials(ssid, pass);
|
||||
}
|
||||
|
||||
bool SecurityStruct_deviceSpecific::getWiFiCredentials(uint8_t index,
|
||||
String& ssid,
|
||||
String& passwd) const
|
||||
{
|
||||
return
|
||||
(index < MAX_EXTRA_WIFI_CREDENTIALS_SEPARATE_FILE) &&
|
||||
_kvs.hasKey(KVS_StorageType::Enum::string_type,
|
||||
createKey(KeyType::WiFi_SSID, index)) &&
|
||||
_kvs.hasKey(KVS_StorageType::Enum::string_type,
|
||||
createKey(KeyType::WiFi_Password, index));
|
||||
index < MAX_EXTRA_WIFI_CREDENTIALS_SEPARATE_FILE &&
|
||||
getCredentials(KeyType::WiFi_SSID, KeyType::WiFi_Password, index, ssid, passwd);
|
||||
}
|
||||
|
||||
void SecurityStruct_deviceSpecific::setWiFiCredentials(
|
||||
uint8_t index,
|
||||
const String& ssid,
|
||||
const String& passwd)
|
||||
{
|
||||
if (index < MAX_EXTRA_WIFI_CREDENTIALS_SEPARATE_FILE)
|
||||
{
|
||||
if (ESPEasy::net::wifi::validWiFiCredentials(ssid, passwd)) {
|
||||
setCredentials(
|
||||
KeyType::WiFi_SSID,
|
||||
KeyType::WiFi_Password,
|
||||
index,
|
||||
ssid,
|
||||
passwd);
|
||||
}
|
||||
else {
|
||||
_kvs.clearKey(
|
||||
KVS_StorageType::Enum::string_type,
|
||||
createKey(KeyType::WiFi_SSID, index));
|
||||
_kvs.clearKey(
|
||||
KVS_StorageType::Enum::string_type,
|
||||
createKey(KeyType::WiFi_Password, index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SecurityStruct_deviceSpecific::getControllerCredentials(uint8_t index,
|
||||
String& user,
|
||||
String& passwd) const
|
||||
{
|
||||
return
|
||||
(index < CONTROLLER_MAX) && getCredentials(
|
||||
KeyType::Controller_User,
|
||||
KeyType::Controller_Password,
|
||||
index,
|
||||
user,
|
||||
passwd);
|
||||
}
|
||||
|
||||
void SecurityStruct_deviceSpecific::setControllerCredentials(uint8_t index,
|
||||
const String& user,
|
||||
const String& passwd)
|
||||
{
|
||||
if (index < CONTROLLER_MAX) {
|
||||
setCredentials(
|
||||
KeyType::Controller_User,
|
||||
KeyType::Controller_Password,
|
||||
index,
|
||||
user,
|
||||
passwd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -133,7 +199,7 @@ void SecurityStruct_deviceSpecific::setCredentials(KeyType keytype_key,
|
||||
const String& key,
|
||||
const String& secret)
|
||||
{
|
||||
_kvs.setValue(createKey(keytype_key, index), key, KVS_StorageType::Enum::string_type);
|
||||
_kvs.setValue(createKey(keytype_key, index), key, KVS_StorageType::Enum::string_type);
|
||||
_kvs.setValue(createKey(keytype_secret, index), secret, KVS_StorageType::Enum::string_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,63 +53,29 @@ public:
|
||||
|
||||
// Move all set WiFi credentials to free up first entry
|
||||
// Typically used for setup page.
|
||||
// void freeUpFirstWiFiCredentials(uint8_t index = 0);
|
||||
// void freeUpFirstWiFiCredentials(uint8_t index = 0);
|
||||
|
||||
bool getWiFiCredentials(uint8_t index,
|
||||
String& ssid,
|
||||
String& passwd) const
|
||||
{
|
||||
return
|
||||
index < MAX_EXTRA_WIFI_CREDENTIALS_SEPARATE_FILE &&
|
||||
getCredentials(KeyType::WiFi_SSID, KeyType::WiFi_Password, index, ssid, passwd);
|
||||
}
|
||||
String& passwd) const;
|
||||
|
||||
void setWiFiCredentials(
|
||||
uint8_t index,
|
||||
const String& ssid,
|
||||
const String& passwd)
|
||||
{
|
||||
if (index < MAX_EXTRA_WIFI_CREDENTIALS_SEPARATE_FILE)
|
||||
{
|
||||
setCredentials(
|
||||
KeyType::WiFi_SSID,
|
||||
KeyType::WiFi_Password,
|
||||
index,
|
||||
ssid,
|
||||
passwd);
|
||||
}
|
||||
}
|
||||
const String& passwd);
|
||||
|
||||
bool getControllerCredentials(uint8_t index,
|
||||
String& user,
|
||||
String& passwd) const
|
||||
{
|
||||
return
|
||||
(index < CONTROLLER_MAX) && getCredentials(
|
||||
KeyType::Controller_User,
|
||||
KeyType::Controller_Password,
|
||||
index,
|
||||
user,
|
||||
passwd);
|
||||
}
|
||||
String& passwd) const;
|
||||
|
||||
void setControllerCredentials(uint8_t index,
|
||||
const String& user,
|
||||
const String& passwd)
|
||||
{
|
||||
if (index < CONTROLLER_MAX) {
|
||||
setCredentials(
|
||||
KeyType::Controller_User,
|
||||
KeyType::Controller_Password,
|
||||
index,
|
||||
user,
|
||||
passwd);
|
||||
}
|
||||
}
|
||||
const String& passwd);
|
||||
|
||||
bool getValue(KeyType keytype,
|
||||
uint8_t index,
|
||||
String& value) const;
|
||||
|
||||
void setValue(KeyType keytype,
|
||||
uint8_t index,
|
||||
const String& value);
|
||||
|
||||
@@ -991,7 +991,7 @@ void afterloadSettings() {
|
||||
#ifdef ESP32
|
||||
// FIXME TD-er: Must also update hostname on other interfaces for ESP32
|
||||
#endif
|
||||
ESPEasy::net::CheckRunningServices(); // To update changes in hostname.
|
||||
ESPEasy::net::CheckRunningServices(true); // To update changes in hostname.
|
||||
}
|
||||
|
||||
/********************************************************************************************\
|
||||
|
||||
@@ -167,7 +167,7 @@ void updateUDPport(bool force)
|
||||
// Or we may need to look into AsyncUDP as that allows to send to specific interfaces.
|
||||
const bool connected = ESPEasy::net::NWPluginCall(NWPlugin::Function::NWPLUGIN_WEBSERVER_SHOULD_RUN);
|
||||
//const bool connected = ESPEasy::net::NetworkConnected();
|
||||
if (!connected || lastUsedUDPPort != 0) {
|
||||
if (!connected || (Settings.UDPPort != lastUsedUDPPort)) {
|
||||
if (lastUsedUDPPort != 0) {
|
||||
portUDP.stop();
|
||||
lastUsedUDPPort = 0;
|
||||
@@ -180,7 +180,7 @@ void updateUDPport(bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.UDPPort != 0) {
|
||||
if ((Settings.UDPPort != lastUsedUDPPort) && Settings.UDPPort != 0) {
|
||||
if (portUDP.begin(Settings.UDPPort) == 0) {
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_ERROR)) {
|
||||
|
||||
@@ -126,6 +126,7 @@ void sendHeadandTail_stdtemplate(bool Tail, bool rebooting) {
|
||||
sendHeadandTail(F("TmplStd"), Tail, rebooting);
|
||||
|
||||
if (!Tail) {
|
||||
// TODO TD-er: Must check clientConnectedToAP()?
|
||||
if (!clientIPinSubnetDefaultNetwork() && ESPEasy::net::wifi::wifiAPmodeActivelyUsed()) {
|
||||
addHtmlError(F("Warning: Connected via AP"));
|
||||
}
|
||||
@@ -504,7 +505,7 @@ void setWebserverRunning(bool state) {
|
||||
#endif
|
||||
}
|
||||
webserverRunning = state;
|
||||
ESPEasy::net::CheckRunningServices(); // Uses webserverRunning state.
|
||||
ESPEasy::net::CheckRunningServices(true); // Uses webserverRunning state.
|
||||
}
|
||||
|
||||
void getWebPageTemplateDefault(const String& tmplName, WebTemplateParser& parser)
|
||||
|
||||
Reference in New Issue
Block a user