diff --git a/cores/esp32/IPAddress.cpp b/cores/esp32/IPAddress.cpp index cabfdf32d26..0575363f254 100644 --- a/cores/esp32/IPAddress.cpp +++ b/cores/esp32/IPAddress.cpp @@ -120,3 +120,6 @@ bool IPAddress::fromString(const char *address) _address.bytes[3] = acc; return true; } + +// declared one time - as external in IPAddress.h +IPAddress INADDR_NONE(0, 0, 0, 0); diff --git a/cores/esp32/IPAddress.h b/cores/esp32/IPAddress.h index aa1d10cee29..3bedd4f8749 100644 --- a/cores/esp32/IPAddress.h +++ b/cores/esp32/IPAddress.h @@ -91,6 +91,6 @@ class IPAddress: public Printable friend class DNSClient; }; -const IPAddress INADDR_NONE(0, 0, 0, 0); - +// changed to extern because const declaration creates copies in BSS of INADDR_NONE for each CPP unit that includes it +extern IPAddress INADDR_NONE; #endif diff --git a/libraries/AsyncUDP/src/AsyncUDP.h b/libraries/AsyncUDP/src/AsyncUDP.h index 95e0b8c1358..be04c01ffaa 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.h +++ b/libraries/AsyncUDP/src/AsyncUDP.h @@ -7,7 +7,6 @@ #include "Stream.h" #include extern "C" { -#include "lwip/ip_addr.h" #include "esp_netif.h" #include "freertos/queue.h" #include "freertos/semphr.h" diff --git a/libraries/WiFi/src/WiFiServer.h b/libraries/WiFi/src/WiFiServer.h index f5b7eaa7bf3..346986abad5 100644 --- a/libraries/WiFi/src/WiFiServer.h +++ b/libraries/WiFi/src/WiFiServer.h @@ -22,7 +22,6 @@ #include "Arduino.h" #include "Server.h" #include "WiFiClient.h" -#include "arpa/inet.h" #include "IPAddress.h" class WiFiServer : public Server { @@ -38,7 +37,8 @@ class WiFiServer : public Server { public: void listenOnLocalhost(){} - WiFiServer(uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_addr(INADDR_ANY),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false) { + // _addr(INADDR_ANY) is the same as _addr() ==> 0.0.0.0 + WiFiServer(uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_addr(),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false) { log_v("WiFiServer::WiFiServer(port=%d, ...)", port); } WiFiServer(const IPAddress& addr, uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_addr(addr),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false) { diff --git a/tools/sdk/esp32/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h b/tools/sdk/esp32/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h index 2fa64448d49..d477580fa99 100644 --- a/tools/sdk/esp32/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h +++ b/tools/sdk/esp32/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h @@ -15,7 +15,7 @@ #ifndef _WIFI_PROV_CONFIG_H_ #define _WIFI_PROV_CONFIG_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/tools/sdk/esp32c3/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h b/tools/sdk/esp32c3/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h index 2fa64448d49..d477580fa99 100644 --- a/tools/sdk/esp32c3/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h +++ b/tools/sdk/esp32c3/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h @@ -15,7 +15,7 @@ #ifndef _WIFI_PROV_CONFIG_H_ #define _WIFI_PROV_CONFIG_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/tools/sdk/esp32s2/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h b/tools/sdk/esp32s2/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h index 2fa64448d49..d477580fa99 100644 --- a/tools/sdk/esp32s2/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h +++ b/tools/sdk/esp32s2/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h @@ -15,7 +15,7 @@ #ifndef _WIFI_PROV_CONFIG_H_ #define _WIFI_PROV_CONFIG_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/tools/sdk/esp32s3/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h b/tools/sdk/esp32s3/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h index 2fa64448d49..d477580fa99 100644 --- a/tools/sdk/esp32s3/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h +++ b/tools/sdk/esp32s3/include/wifi_provisioning/include/wifi_provisioning/wifi_config.h @@ -15,7 +15,7 @@ #ifndef _WIFI_PROV_CONFIG_H_ #define _WIFI_PROV_CONFIG_H_ -#include +#include #ifdef __cplusplus extern "C" {