1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

526 Commits

Author SHA1 Message Date
M Hightower
503988132d
fNull pointer call from WiFiClient::localIP() to IPAddress (#7221)
Fixes exception 28 in IPAddress(const ipv4_addr* fw_addr); with null ip_addr
pointer passed in by WiFiCient.cpp localIP(). I assumed that localIP()
was called shortly after _pcb became null.
2020-04-17 23:19:46 +02:00
david gauchard
4f27ce16b3
Fix TCP send to IPv6 link local addresses (#7207)
credit: Simon Arlott @nomis - similar to #6541 for TCP (#7207)
2020-04-11 12:46:07 +02:00
Simon Arlott
ee619d367f
Fix UDP send to IPv6 link local addresses (#6541)
lwIP's tcp/udp_connect() and tcp/udp_bind() functions automatically
set the zone if it is required but missing, but udp_connect() is not
used so this doesn't happen.

Explicitly set the zone to the default network interface if it is
required for the type of address being used. Otherwise there is no
zone set and packets to a link local destination don't go anywhere.
2020-04-11 12:05:23 +02:00
david gauchard
1a9988ecf1
fix memleak (#7203) 2020-04-09 09:59:12 -07:00
Heiko Krupp
fad056442d
Make DNS resolution order selectable during runtime or compile time (#6865)
* Make DNS resolution order selectable during runtime or compile time (only in dual stack mode).

* Extend IPv6 example to show usage of new hostByName function with selectable resolving order

* Fix function definition of fqdn_rt in IPv6.ino.

* Fix function call.

* Fix missing bracket...

* Only run if built with dual stack support

* Make DNS resolution order selectable during runtime or compile time (only in dual stack mode).

* Extend IPv6 example to show usage of new hostByName function with selectable resolving order

* Fix function definition of fqdn_rt in IPv6 example.

* Implement enum class for resolve type

* Fix example IPv6.ino

* Fix typedef in ESP8266WiFiGeneric.h function call

* Change enum class definition to not depend on lwip/dns.h

* Move err_t err definition outside switch. Fix typecast.

* Always define DNSResolveType as pio test otherwise failes even if the enum class isn't used.

Co-authored-by: altelch <heiko.krupp@rhrk.uni-kl.de>
Co-authored-by: david gauchard <gauchard@laas.fr>
2020-04-09 18:17:54 +02:00
david gauchard
bc170e6d63
WiFi: ARP gratuitous API for wifi station mode (#6889)
* wifi: ARP gratuitous API for wifi station mode

* fix with lwip1

* update comment

* update API to allow changing interval on the fly

* update API

* remove debug lines

* mock lwIP's etharp_request()

* unsigned interval

* use scheduled ticker

* ticker: +attach_ms_scheduled_accurate
ticker: +comment
gratuitous: use attach_ms_scheduled_accurate

* move to experimental namespace

* fix for lwIP-v1.4

* attempt to make pio happy

* use directly ETSTimer instead of Ticker
2020-04-09 16:19:15 +02:00
Earle F. Philhower, III
e252873263
Use 2nd stack for update signature verification (#7149)
* Use 2nd stack for update signature verification

Fixes #7145

When doing a signed update, the signature calculation can use a lot of
stack, so move it silently to the BearSSL second stack.

Also fix a memory leak of signature-bytes found by @JiriBilek

* Reset state on any error condition in Updater::end
2020-03-14 16:10:40 -07:00
david gauchard
b8e4ca48a4
udp: fix again pbuf management (#7132)
* udp: fix again pbuf management
* Process rx buffer size, cache it, because _rx_buf->tot_len is *not* the total size
2020-03-04 21:40:50 +01:00
LaborEtArs
4b2bf45933
Additions to UdpContext needed for LEAmDNS2 (#7048)
* Addition to UdpContext needed for LEAmDNS2
2020-02-24 14:56:00 +01:00
david gauchard
2d58be744b
TCP: fixes backlog limit handling, and allows ephemeral TCP connections (#7096)
* fix backlog limit handling, and allow ephemeral TCP connections
* do not retain empty connections
2020-02-24 07:16:55 +01:00
Szabolcs Székelyi
e6decacd0a
Fix/enable UDP packet reassembly (#7036)
* Fix/enable UDP packet reassembly

UdpContext didn't care about pbuf chaining when receiving datagrams, leading
to fragments delivered to the application as individual packets.

* Provide pbuf_get_contiguous for backwards compatibility with LwIP 1.4

Implementation copied verbatim from LwIP 2.1.2

* Cosmetic changes to meet coding style

Co-authored-by: david gauchard <gauchard@laas.fr>
Co-authored-by: Develo <deveyes@gmail.com>
2020-02-22 07:38:14 +01:00
david gauchard
e752e96e9f
lwip2 updates: no more git sub-sub-module deps, faster checksum, backlog limitation and other fixes (#6887)
* upstream lwIP is now downloaded by a makefile, not subsubmoduled

* lwip2: upstream lwIP not sub-sub-modules anymore
lwip2: Allow IPv4 and IPv6 DNS and SNTP server configured via DHCP to co-exist (patch against upstream)

* lwip2: enable tcp-listen-with-backlog feature

* lwip2 submodule update:
- enable more efficient chksum algorithm thanks to Richard Allen
- enable tcp listener with backlog

* more comments, fix backlog management, fix API
* move default value definition in .cpp
because one must not believe it can be redefined before including WiFiServer.h

* improved backlog handling, it is no more a breaking change
2020-02-18 06:54:50 +01:00
Earle F. Philhower, III
00440cd84a
Remove memory leak on multiple calls to initCertStore (#7021)
In some cases, `initCertStore` may need to be called multiple times
(i.e. to update certs w/oa reboot).  In that case, the saved file names
leaked when the new ones were `malloc()`'d.

Fix by freeing the old strings, if present.
2020-01-17 10:10:17 -08:00
LaborEtArs
5e537e5783 Updating _port to really used port and made _port accessible (#7003)
* Updating _port to really used port and made _port accessible

* 2. Try
2020-01-08 21:36:39 -03:00
david gauchard
3e6c25c21b
udp: limit buffer depth (#6895)
This commit avoids OOMs on an udp corner case where a delay() in the main
loop would allow memory filling.

A memory leak has been observed with such semantically forbidden delay,
unsolved yet, and preventing to use a simple counter instead of walking
through a linked list.  The count limit is however small.
2019-12-10 11:04:49 +01:00
Earle F. Philhower, III
ebae47c13a
Expand BSSL stack (#6819)
Fixes #6811 which found an issue where connecting to scripts.google.com
would *occasionally* cause a crash.  On inspection, it was found that up
to 5828 bytes of stack were used once in a while, so expand the stack to
5900 bytes to cover this case plus a little extra.
2019-11-20 18:05:38 -07:00
Develo
9b96f53778
Fix typo in mode timeout loop (#6801)
Fix typo to make timeout 1s instead if 1ms, as originally intended.
2019-11-19 01:27:10 -03:00
Dirk O. Kaar
240ae5ef26 Add/unify comments for target and source sites of async scheduling via delay()/esp_yield()/esp_schedule() (#6780) 2019-11-15 14:53:43 +01:00
Dirk O. Kaar
739bcd3fd5 Updated EspSoftwareSerial brings backward compatibility for ctor/begin() pair (only for the common cases with complete default argument use) (#6746) 2019-11-10 10:48:12 +01:00
Develo
453eb2d064
Add wait loop at the end of mode, refactor can_yield (#6721)
* Add wait loop at the end of mode, refactor can_yield

* fix mock build
2019-11-07 18:25:20 -03:00
NayanKaran
348c58b644 added public cleanAPlist() function (#4107)
* added public cleanAPlist() function.

* Update ESP8266WiFiMulti.cpp

* Update ESP8266WiFiMulti.cpp

* Add cleanAPlist to object method header
2019-10-31 10:58:35 -07:00
david gauchard
122e87019f
fix because of SoftwareSerial API change (#6635) 2019-10-13 00:32:07 +02:00
Dirk Mueller
3890e1af1e Put longer string literals into PROGMEM (#6588)
* Put longer string literals into PROGMEM

* Use Flash Strings for Debug output

This is hopefully very infrequently used, so it shouldn't
be in main memory.
2019-10-03 23:17:36 -03:00
johnm545
5d609fd294 Fix WiFiClientSecure::available() blocking on dropped connections (#6449)
* Fix WiFiClientSecure::available blocking

Added a check of WiFiClient::availableForWrite to prevent blocking writes when the _run_until blocking flag is false

* change availForWrite from int to size_t

* add timeout to _run_until loop

fixes #6464

* use polledTimeout with _timeout millis
2019-09-17 01:03:34 -03:00
david gauchard
273f4000f0
Experimental: add new WiFi (pseudo) modes: WIFI_SHUTDOWN & WIFI_RESUME (#6356)
* add new WiFimodes: WIFI_SHUTDOWN & WIFI_RESUME with example
* restore WiFi.onWiFiModeChange()
2019-09-05 03:01:01 +02:00
david gauchard
291b321e62
ClientContext: restore use of two different pending booleans for connect and write #6483 2019-09-04 01:22:56 +02:00
Earle F. Philhower, III
0a031ce957
Move all scripts and documentation to Python3 (#6378)
* Move all scripts and documentation to Python3

Python 2 EOL is Jan 1, 2020.  Migrate scripts to run under Python 3.

Under Windows, we're already running Python 3.7, by dumb luck.  The
oddness is that the Windows standalone executable for Python 3 is called
"python" whereas under UNIX-like OSes it's called "python3" with
"python" always referring to the Python 2 executable.  The ZIP needs to
be updated to include a Python3.exe (copy of Python.exe) so that we can
use the same command lines under Linux and Windows, and to preserve my
sanity.

Fixes #6376

* Add new Windows ZIP with python3.exe file

* Sort options in boards.txt generation for repeatability

The order of the board opts dict changes depending on the Python version
and machine, so sort the options before printing them to get a stable
ordering.

* Re-add Python2 compatibility tweaks

Most scripts can run as Python 2 or Python 3 with minimal changes, so
re-add (and fix, as necessary) compatibility tweaks to the scripts.
2019-08-28 12:42:48 -07:00
Dirk O. Kaar
e201f614e8 Fix reverse dependency core Updater -> library ESP8266WiFi (#6398)
* Per @earlephilhower suggestion

* Hints from @earlephilhower

* Namespace BearSSL in core "feels" wrong - using catch-all esp8266 instead.

* After review remarks by @earlephilhower
2019-08-28 11:07:04 -07:00
david gauchard
06f1865628
new network feature: NAPT (widely known as NAT) (#6360)
* lwIP: napt patches (enabled with lwip2 w/o IPv6 w/ features)
2019-08-28 17:51:14 +02:00
david gauchard
45dbc65dba
standardizes processing of _delaying in lwIP callbacks (remove assert) (#6460) 2019-08-28 15:24:57 +02:00
david gauchard
0937b076c8
ClientContext: break timeout delays also on error while writing or connecting (#6454)
This PR stops the 1ms-delay loop also when a tcp error occurs (previously this was done only when tcp had just connected or a write/send had succeeded).
The tcp error can be any, in this case with pubsubclient it is "connection refused" after the mqtt server disappeared and pubsubclient tries to reconnect.
2019-08-27 15:26:27 +02:00
Ilya
8f45a0fb91 Set method _connectSSL as protected (#6424) 2019-08-16 13:23:05 +02:00
Earle F. Philhower, III
adfc28d7d8
Fix basic SSL server definitions (#6402)
A typo was present in several ifdefs which would allow a server to negotiate
an EC connection even when in basic SSL mode.  When this happened, a crash
would occur (since there were no EC or advanced AES modes installed).

Fix the typo, fixes #6397
2019-08-08 21:54:59 -07:00
Earle F. Philhower, III
52f8c62b81
Fix GCC 9.1 warnings (except Ticker.h, gdbstub) (#6298)
Cleans up all warnings seen w/GCC 9.1 to allow it to track the main
branch more easily until 3.x.

Does not include Ticker.h "fix" of pragmas around a function cast we're
doing that GCC9 doesn't like, that will be addressed separately and
maybe only in the 3.0 branch.

Does not include GDB hook fix, either, because the pragmas required
to disable the GCC9.1 warnings don't exist in 4.8 at all.
2019-07-14 21:22:49 -07:00
Earle F. Philhower, III
c18b402c31
Add a dump of received FP and CERT when in debug mode (#6300)
* Add a dump of received FP and CERT when in debug mode

To simplify BearSSL debugging, print the received FP (when it doesn't
match the expected) and the binary certificate (always), when in debug
mode.

* Add documentation section on FP mismatch in rare instances.
2019-07-14 14:09:44 -07:00
Earle F. Philhower, III
d2a487dfd9 Clean up code to build under GCC7, fix pgm_read_unaligned (#6270)
Apply most compatible changes needed to get the core compiling under GCC
7.2 to the main gcc 4.8 tree to ease porting for 3.0.0.

Update pgmspace.h with corrected and optimized unaligned pgm_read
macros.  Now pgm_read_dword in the unaligned case gives proper results
even if optimization is enabled and is also written in assembly and only
1 instruction longer than the pgm_read_byte macro (which also has been
optimized to reduce 1 instruction).  These changes should marginally
shrink code and speed up flash reads accordingly.

The toolchain should/will be rebuilt at a later time with this
optimization to ensure it's used in the libc.a/etc. files.
2019-07-08 10:17:48 +02:00
david gauchard
3f0f2143f8
fix bug in storing UDP remote address (#6263) 2019-07-06 12:30:40 +02:00
Alexander Emelianov
4bfa2ae889 TCP connect and send delay fix (#6213)
* TCP connect and send delay fix
Implement early exit as connection established or data already sent.
(Previous implementation was exiting only on timeout expired)
2019-07-05 12:11:40 +02:00
Earle F. Philhower, III
a0634a71a9
Fix mixup with boolean/bitwise or for BSSL probing (#6252)
Fix an error identified by -wextra where the size of the SSL extension
section in the probeMFLN call only.
2019-07-04 09:14:50 -07:00
dav1901
16312949c9 Add timeout to STA::waitForConnectResult (#5371) 2019-07-04 14:08:02 +02:00
Chris van Marle
6272b49406 Updater signature validation - format incompatible w/RFC8017 (#6250)
* Add hash OID to signature verification (#6201)

* Add legacy signing option

* Describe and use the legacy option of signing.py
2019-07-04 12:17:30 +02:00
Earle F. Philhower, III
7036297920 Convert ESP8266WebServer* into templatized model (#5982)
* Convert ESP8266WebServer* into templatized model

Supercedes #4912

Refactor the three versions of ESP8266WebServer and *WebServerSecure to a
single templated class. Use "using" to enable old, non-templated names to b
used (so no user changes required to compile or run).

Fixes #4908 and clean up the code base a lot.

Basic tests run (the ones in the example code).

No code changes are required in userland except for setting the SSL
certificates which now use a cleaner "getServer()" accessor and lets the
app use the native BearSSL calls on the WiFiClientSecure object.

@devyte should be proud, it removes virtuals and even has template specialization...

* Fix HTTPUpdate templates and examples

* Fix HTTPUpdateServer library build

Need to remove dot-a linkage since there are no .cpp files in the
directory anymore due to templates.

* Provide backward-compat names for updt template

Allow existing code to use the same well known names for
HTTPUpdateSecure.

* Remove ClientType from all templates, auto-infer

Remove the ClientType template parameter from all objects.  Simplifies
the code and makes it more foolproof.

Add a "using" in each server to define the type of connection returned
by all servers, which is then used in the above templates automatically.

* Can safely include FS.h now that SD/SPIFFS unified

* Move the templates/objects to their own namespaces

* Fix merge issues with untemplated methods

* Address review comments

* Fix mock test, remove warnings inside test dir

Make the simple mock test CI job pass and clean up
any spurious warnings in the test directory.

There still are warnings in the libraries and core, but they
should be addressed in a separate PR.
2019-07-04 10:58:22 +02:00
david gauchard
5306976db1
udp remote pbuf helper: honor fragmented packets (#6222)
fix for #5960 didn't take fragmented packets into account
fixes #6218
2019-06-26 21:35:43 +02:00
david gauchard
59db907647
lwip2: (re)fix setting static ip address (#6194) 2019-06-17 23:57:31 +02:00
Earle F. Philhower, III
9f03bbb8c3
Add an EC keyed certificat to BearSSL Server example (#6202)
Needed for future automated performance test suite use, to allow
selecting between EC and RSA signed keys for the server's cert.
2019-06-14 14:58:29 -07:00
Earle F. Philhower, III
fe01433f78
Obey the BASIC_SSL request for TLS servers (#6187)
When in basic SSL mode, don't include ciphers for EC for the server by
replacinf the BearSSL "support everything" init call with our own
version which obeys the requested BASIC_SSL.

Saves ~46KB on TLS servers, about the same as basic SSL saves for
clients.
2019-06-07 19:40:33 -07:00
Earle F. Philhower, III
8859b818d8
Make CertStore natively use File interface (#6131)
__This is a breaking change, but the header and example did warn
everyone that this API was in flux due to the incompatible SD and SPIFFS
File implementations.__

BearSSL CertStores now simply need a filesystem and the names of the
data (generated on-chip) and archive (uploaded by user) files on it.
No more need to roll your own virtual CertStoreFile class.

Update the library, examples, and device test.
2019-05-30 12:53:03 -07:00
s-hadinger
69311c8fe1 Added BR_OPT_NO_RENEGOTIATION flag to forbid TLS renegociation (#6165) 2019-05-30 06:43:45 -07:00
Jean Lescut-Muller
147b5fbb98 Typo fix in ESP8266WiFiAP.cpp (#6134) 2019-05-23 07:55:46 -07:00
Dave
912c0db091 Remove deadlock when server is not acking our data (#6107)
* Use bounded waiting instead of infinite one to avoid deadlock

* Reduce timeout to fail much sooner if server is not acking our data

* Return timeout to 15 seconds on every disconnect

* Add comment to introduced delay to make it super clear
2019-05-19 22:38:24 +02:00