Skip to content

Commit 5b4313b

Browse files
authored
Merge branch 'master' into https-serve
2 parents 065a835 + cdb5495 commit 5b4313b

34 files changed

+504
-149
lines changed

boards.txt

Lines changed: 121 additions & 0 deletions
Large diffs are not rendered by default.

cores/esp8266/Client.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,27 @@
2626
class Client: public Stream {
2727

2828
public:
29-
virtual int connect(CONST IPAddress& ip, uint16_t port) =0;
29+
virtual int connect(IPAddress ip, uint16_t port) =0;
3030
virtual int connect(const char *host, uint16_t port) =0;
3131
virtual size_t write(uint8_t) =0;
3232
virtual size_t write(const uint8_t *buf, size_t size) =0;
3333
virtual int available() = 0;
3434
virtual int read() = 0;
3535
virtual int read(uint8_t *buf, size_t size) = 0;
3636
virtual int peek() = 0;
37-
virtual bool flush(unsigned int maxWaitMs = 0) = 0;
38-
virtual bool stop(unsigned int maxWaitMs = 0) = 0;
37+
virtual void flush() = 0;
38+
virtual void stop() = 0;
3939
virtual uint8_t connected() = 0;
4040
virtual operator bool() = 0;
4141
protected:
42-
CONST uint8_t* rawIPAddress(CONST IPAddress& addr) {
42+
uint8_t* rawIPAddress(IPAddress& addr) {
4343
return addr.raw_address();
4444
}
45-
;
45+
#if LWIP_VERSION_MAJOR != 1
46+
const uint8_t* rawIPAddress(const IPAddress& addr) {
47+
return addr.raw_address();
48+
}
49+
#endif
4650
};
4751

4852
#endif

cores/esp8266/FunctionalInterrupt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ typedef void (*voidFuncPtrArg)(void*);
1111
extern "C" void ICACHE_RAM_ATTR __attachInterruptArg(uint8_t pin, voidFuncPtr userFunc, void*fp , int mode);
1212

1313

14-
void interruptFunctional(void* arg)
14+
void ICACHE_RAM_ATTR interruptFunctional(void* arg)
1515
{
1616
ArgStructure* localArg = (ArgStructure*)arg;
1717
if (localArg->functionInfo->reqScheduledFunction)

cores/esp8266/Udp.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,18 @@ class UDP: public Stream {
7979
virtual void flush() =0; // Finish reading the current packet
8080

8181
// Return the IP address of the host who sent the current incoming packet
82-
virtual IPAddress remoteIP() const =0;
82+
virtual IPAddress remoteIP() =0;
8383
// Return the port of the host who sent the current incoming packet
84-
virtual uint16_t remotePort() const =0;
84+
virtual uint16_t remotePort() =0;
8585
protected:
86-
CONST uint8_t* rawIPAddress(CONST IPAddress& addr) {
86+
uint8_t* rawIPAddress(IPAddress& addr) {
8787
return addr.raw_address();
8888
}
89+
#if LWIP_VERSION_MAJOR != 1
90+
const uint8_t* rawIPAddress(const IPAddress& addr) {
91+
return addr.raw_address();
92+
}
93+
#endif
8994
};
9095

9196
#endif

cores/esp8266/core_esp8266_wiring_digital.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@ void ICACHE_RAM_ATTR interrupt_handler(void *arg) {
171171
extern void cleanupFunctional(void* arg);
172172

173173
extern void ICACHE_RAM_ATTR __attachInterruptArg(uint8_t pin, voidFuncPtr userFunc, void *arg, int mode) {
174+
175+
// #5780
176+
// https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map
177+
if ((uint32_t)userFunc >= 0x40200000)
178+
{
179+
// ISR not in IRAM
180+
::printf((PGM_P)F("ISR not in IRAM!\r\n"));
181+
abort();
182+
}
183+
174184
if(pin < 16) {
175185
ETS_GPIO_INTR_DISABLE();
176186
interrupt_handler_t *handler = &interrupt_handlers[pin];

doc/esp8266wifi/bearssl-client-secure-class.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ Once you have verified (or know beforehand) that MFLN is supported you can use t
180180

181181
In certain applications where the TLS server does not support MFLN (not many do as of this writing as it is relatively new to OpenSSL), but you control both the ESP8266 and the server to which it is communicating, you may still be able to `setBufferSizes()` smaller if you guarantee no chunk of data will overflow those buffers.
182182

183+
bool getMFLNStatus()
184+
^^^^^^^^^^^^^^^^^^^^
185+
186+
After a successful connection, this method returns whether or not MFLN negotiation succeeded or not. If it did not succeed, and you reduced the receive buffer with `setBufferSizes` then you may experience reception errors if the server attempts to send messages larger than your receive buffer.
187+
183188
Sessions (Resuming connections fast)
184189
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185190

libraries/ESP8266WiFi/examples/BearSSL_MaxFragmentLength/BearSSL_MaxFragmentLength.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ int fetchMaxFragmentLength() {
8787
}
8888
client.connect("tls.mbed.org", 443);
8989
if (client.connected()) {
90+
Serial.printf("MFLN status: %s\n", client.getMFLNStatus() ? "true" : "false");
9091
Serial.printf("Memory used: %d\n", ret - ESP.getFreeHeap());
9192
ret -= ESP.getFreeHeap();
9293
fetch(&client);

libraries/ESP8266WiFi/examples/Udp/Udp.ino

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
unsigned int localPort = 8888; // local port to listen on
2727

2828
// buffers for receiving and sending data
29-
char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet,
29+
char packetBuffer[UDP_TX_PACKET_MAX_SIZE + 1]; //buffer to hold incoming packet,
3030
char ReplyBuffer[] = "acknowledged\r\n"; // a string to send back
3131

3232
WiFiUDP Udp;
@@ -49,21 +49,15 @@ void loop() {
4949
// if there's data available, read a packet
5050
int packetSize = Udp.parsePacket();
5151
if (packetSize) {
52-
Serial.print("Received packet of size ");
53-
Serial.println(packetSize);
54-
Serial.print("From ");
55-
IPAddress remote = Udp.remoteIP();
56-
for (int i = 0; i < 4; i++) {
57-
Serial.print(remote[i], DEC);
58-
if (i < 3) {
59-
Serial.print(".");
60-
}
61-
}
62-
Serial.print(", port ");
63-
Serial.println(Udp.remotePort());
52+
Serial.printf("Received packet of size %d from %s:%d\n (to %s:%d, free heap = %d B)\n",
53+
packetSize,
54+
Udp.remoteIP().toString().c_str(), Udp.remotePort(),
55+
Udp.destinationIP().toString().c_str(), Udp.localPort(),
56+
ESP.getFreeHeap());
6457

6558
// read the packet into packetBufffer
66-
Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
59+
int n = Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
60+
packetBuffer[n] = 0;
6761
Serial.println("Contents:");
6862
Serial.println(packetBuffer);
6963

@@ -72,7 +66,7 @@ void loop() {
7266
Udp.write(ReplyBuffer);
7367
Udp.endPacket();
7468
}
75-
delay(10);
69+
7670
}
7771

7872
/*

libraries/ESP8266WiFi/keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ setBufferSizes KEYWORD2
183183
getLastSSLError KEYWORD2
184184
setCertStore KEYWORD2
185185
probeMaxFragmentLength KEYWORD2
186+
getMFLNStatus KEYWORD2
186187

187188
#WiFiServerBearSSL
188189
setRSACert KEYWORD2

libraries/ESP8266WiFi/src/WiFiClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ int WiFiClient::connect(const String& host, uint16_t port)
137137
return connect(host.c_str(), port);
138138
}
139139

140-
int WiFiClient::connect(CONST IPAddress& ip, uint16_t port)
140+
int WiFiClient::connect(IPAddress ip, uint16_t port)
141141
{
142142
if (_client) {
143143
stop();

libraries/ESP8266WiFi/src/WiFiClient.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,31 @@ class WiFiClient : public Client, public SList<WiFiClient> {
5353
WiFiClient& operator=(const WiFiClient&);
5454

5555
uint8_t status();
56-
virtual int connect(CONST IPAddress& ip, uint16_t port);
57-
virtual int connect(const char *host, uint16_t port);
56+
virtual int connect(IPAddress ip, uint16_t port) override;
57+
virtual int connect(const char *host, uint16_t port) override;
5858
virtual int connect(const String& host, uint16_t port);
59-
virtual size_t write(uint8_t);
60-
virtual size_t write(const uint8_t *buf, size_t size);
59+
virtual size_t write(uint8_t) override;
60+
virtual size_t write(const uint8_t *buf, size_t size) override;
6161
virtual size_t write_P(PGM_P buf, size_t size);
6262
size_t write(Stream& stream);
6363

6464
// This one is deprecated, use write(Stream& instead)
6565
size_t write(Stream& stream, size_t unitSize) __attribute__ ((deprecated));
6666

67-
virtual int available();
68-
virtual int read();
69-
virtual int read(uint8_t *buf, size_t size);
70-
virtual int peek();
67+
virtual int available() override;
68+
virtual int read() override;
69+
virtual int read(uint8_t *buf, size_t size) override;
70+
virtual int peek() override;
7171
virtual size_t peekBytes(uint8_t *buffer, size_t length);
7272
size_t peekBytes(char *buffer, size_t length) {
7373
return peekBytes((uint8_t *) buffer, length);
7474
}
75-
virtual bool flush(unsigned int maxWaitMs = 0);
76-
virtual bool stop(unsigned int maxWaitMs = 0);
77-
virtual uint8_t connected();
78-
virtual operator bool();
75+
virtual void flush() override { (void)flush(0); }
76+
virtual void stop() override { (void)stop(0); }
77+
bool flush(unsigned int maxWaitMs);
78+
bool stop(unsigned int maxWaitMs);
79+
virtual uint8_t connected() override;
80+
virtual operator bool() override;
7981

8082
IPAddress remoteIP();
8183
uint16_t remotePort();

libraries/ESP8266WiFi/src/WiFiClientSecureAxTLS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ WiFiClientSecure::WiFiClientSecure(ClientContext* client, bool usePMEM,
9595
_ssl->connectServer(client, _timeout);
9696
}
9797

98-
int WiFiClientSecure::connect(CONST IPAddress& ip, uint16_t port)
98+
int WiFiClientSecure::connect(IPAddress ip, uint16_t port)
9999
{
100100
if (!WiFiClient::connect(ip, port)) {
101101
return 0;

libraries/ESP8266WiFi/src/WiFiClientSecureAxTLS.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class WiFiClientSecure : public WiFiClient {
3535
WiFiClientSecure() __attribute__((deprecated("Upgrade to BearSSL is advised, check https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/WiFiClientSecure.h#L25-L99")));
3636
~WiFiClientSecure() override;
3737

38-
int connect(CONST IPAddress& ip, uint16_t port) override;
38+
int connect(IPAddress ip, uint16_t port) override;
3939
int connect(const String& host, uint16_t port) override;
4040
int connect(const char* name, uint16_t port) override;
4141

@@ -51,7 +51,8 @@ class WiFiClientSecure : public WiFiClient {
5151
int read() override;
5252
int peek() override;
5353
size_t peekBytes(uint8_t *buffer, size_t length) override;
54-
bool stop(unsigned int maxWaitMs = 0) override;
54+
void stop() override { (void)stop(0); }
55+
bool stop(unsigned int maxWaitMs);
5556

5657
bool setCACert(const uint8_t* pk, size_t size);
5758
bool setCertificate(const uint8_t* pk, size_t size);

0 commit comments

Comments
 (0)