1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

564 Commits

Author SHA1 Message Date
isadora-6th
996211f132
Compile failure fix with FS_NO_GLOBALS flag (#7685) 2020-10-29 17:11:57 -07:00
Earle F. Philhower, III
77bd71ec29
Add Stream loaders for BearSSL (#7675)
Fixes #7671

Allows for code to do things like read certs from LittleFS or even HTTP
connections with code like:

  File cert = LittleFS.open("/client-crt.pem", "r");
  clientCert = new X509List(cert, cert.size());
  cert.close();
2020-10-28 07:22:41 -07:00
Earle F. Philhower, III
cfdcff1028
Catch and display SSL errors for fatal alerts (#7681)
Partial fix to #7678
2020-10-27 22:18:26 -07:00
Earle F. Philhower, III
7f38e141c7
BREAKING: Add Print::availableForWrite method (#7658)
* Add Print::availableForWrite method

Adds an availableForWrite() method to the Print class, matching current
ArduinoCore-API commit 398e70f188e2b861c10d9ffe5e2bfcb6a4a4f489 .

Hook availableForWrite into the SDFS filesystem (other FSes don't have
this capability built-in).

Fixes #7650

* WiFiClient::availableForWrite proto matching Print

* Fix Netdump signedness warning

* Clean up Serial availableForWrite

This is evidently a breaking change due to the type difference.
Arduino's `availableForWrite` returns an `int`, while the
(multiply-implemented, non-virtual) core `availableForWrite` returned
`size_t`.
2020-10-27 11:55:42 +01:00
Erriez
95de525af9
Refactor WiFi scan example (#7655) 2020-10-27 11:20:07 +01:00
Develo
81a10a48af
BREAKING: Change return type of channel() (#7656) 2020-10-15 14:48:00 -07:00
Develo
0452f4728f
BREAKING: Change return type of RSSI() (#7657) 2020-10-15 14:00:30 -07:00
Develo
1c624dd76a
BREAKING: Add Wrong Password wifi status case (#7652)
* Add Wrong Password wifi status case
* Add wrong password case for status return
* Add wrong password case for debug
* Add Wrong password case to interactive example
* Add case for wrong password to station doc
* Add case for wrong password to resumeFromShutdown
* Add wrong password case to wifi readme
* Update ESP8266WiFiGeneric.cpp
2020-10-15 09:52:17 -07:00
Earle F. Philhower, III
200e47fc7b
Fix error when debug enabled but no port chosen (#7648)
When the debug level for the device includes SSL but the debug port is
chosen as "None," don't attempt to write debug messages.

Fixes #7638
2020-10-09 15:54:39 -07:00
Dirk Mueller
4aeb0f5cca
Use direct member initialization instead of ctr initialisation (#7558)
* Use direct member initialization instead of ctr initialisation

This removes a bit of code repetition.

* Add symbolic names for member initializers
2020-10-05 13:56:08 -07:00
Earle F. Philhower, III
85ba53a249
Remove stray axtls refs, deprecated compat funcs (#7626)
Remove the axTLS compatability functions from WiFiClient/ServerSecure,
device tests for axTLS, and any document refs to axTLS.
2020-10-02 21:39:36 -07:00
Erriez
fceb390a1a Redesign ESP8266WiFiMulti.[cpp|h]
Fixed critical issues WiFiMulti library:
- WiFi scan timeout implemented to prevent endless connect loop
- Fallback implemented on WiFi connect failure to prevent endless loop
- Fast WiFi connection at startup
- Improved debug prints
- Doxygen added
- Code maturing
- Example update

Make functions not related to ESP8266WiFiMulti class static
Revert static functions startScan and printWiFiScan()
Use PolledTimeout.h to protect while loops
Move static functions beginning of the file
Add connect timeout to example
2020-10-02 17:37:32 +02:00
Labor-Et-Ars
a3281fe2f3
LEA mDNS v2 (#7540)
* LEAmDNSv2
2020-09-25 11:12:39 +02:00
9bryan
8258db53da
Fix error message typo (#7581)
Sorry, I know it's little.  But it eats at me...
2020-09-07 10:46:13 -07:00
gnorbsl
88be34e2dc
Update certs-from-mozilla.py (#7578)
* Update certs-from-mozilla.py

Check if ar exists, if not tell the user what to get to prevent issue #7300 also dynamically get certs instead of hardcoded row item https://github.com/esp8266/Arduino/pull/7573#issuecomment-686192353
changed comment for missing ar exception
updated path and check for openssl
2020-09-07 15:06:36 +02:00
gnorbsl
e636a6587c
Update certs-from-mozilla.py (#7573)
Looks like Mozilla changed the csv, certs are now at row 32
2020-09-02 19:53:54 -07:00
Dirk Mueller
df01d19d29
Reduce codesize of setOutputPower (#7572)
The logic can be simplified by using integer logic without a functional
change. Reduces code size by 40% (78 bytes -> 46 bytes) and silences
a Warith-conversion warning.
2020-09-02 08:47:48 -07:00
Earle F. Philhower, III
247d5f1218
Merge branch 'master' into stdnothrow 2020-08-30 12:39:55 -07:00
Dirk Mueller
953dfd945f
Avoid float-double-conversion (#7559)
Converting floats to doubles is very expensive on esp8266, so prefer
calculations or comparisons as float. This saves 10% (20 bytes) of the
String::parseFloat() code size and probably quite a bit of runtime
overhead.
2020-08-28 17:09:44 -04:00
david gauchard
11f7d1766e remove (std::nothrow) where nullptr case is not handled
remove legacy new management
2020-08-24 09:51:58 +02:00
david gauchard
6925982284 replace new by new (std::nothrow), remove arduino_new 2020-08-17 18:15:45 +02:00
Earle F. Philhower, III
9afb084159
Clean up minor warnings from LGTM.com (#7500)
* Clean up minor warnings from LGTM.com

LGTM (Semmie) is a tool, bought by GitHub last year, that conducts basic
linting tasks on code and HTML.

Clean up the warnings identified in the latest report:
https://lgtm.com/projects/g/esp8266/Arduino/?mode=list

No functionality should change, however this may fix some issues with
the perl utilities not exiting properly on a Ctrl-C from the command
line.

* Back out HTML changes and rerun boards.txt.py
2020-08-03 19:19:04 -07:00
Earle F. Philhower, III
a8e35a579c
Add valgrind mocked test to CI (#7501)
Run valgrind on host mock example runs to catch more bugs in CI.  These
tests would have caught the problem in #7464 before users did.

Add a list of some randomly picked examples to run, and add an option to
run the loop exactly once in the host mock routine, so the test will
actually exit under valgrind.
2020-08-03 19:00:51 -07:00
Earle F. Philhower, III
63b41bcfab
Use root cert, not fingerprint for api.github.com (#7490)
In the HTTPS example we were using a fingerprint which changes almost
daily as the github.com certificates are regenerated.  Replace this with
a trust anchor based on the ultimate root CA that github.com uses to
sign their certificates.  Assuming they don't change CAs, this
certificate should be good until 2030+

Fixes #7489
2020-07-28 12:11:00 -07:00
Earle F. Philhower, III
355b291614
CVE-2020-12638 workaround for WPA downgrade attack (#7486)
* CVE-2020-12638 workaround for WPA downgrade attack

When connected to an encrypted (WEP/WPA) router, a rogue packet can
cause the ESP8266 WiFi stack to drop to an unecrypted rogue network of
the same SSID.

Handle this by dropping the WiFi connection immediately and reconnecting
to the stored WPA/WEP network requested by the application, whenever the
AUTHMODE changes to OPEN from a secured mode.

https://lbsfilm.at/blog/wpa2-authenticationmode-downgrade-in-espressif-microprocessors
for more details.
2020-07-26 10:11:14 -07:00
Earle F. Philhower, III
f42cf7a5a4
Fix uninitted class variables from #7464 (#7478)
PR #7464 removed the reset of client authentication settings when server
authentication settings were changed, however it never did initialize
the client authentication information to nullptr in the constructor.
This can result in crashes during connections when client certs are not
applied.

Fix by resetting the client authenticaion variables on object
construction.
2020-07-22 22:10:44 -07:00
Earle F. Philhower, III
91427a1695
Keep client certs when server authentication set (#7464)
WiFiClientSecure.setInsecure() was clearing the secret key (but not the
_chain public client cert) incorrectly.  The other server authentication
modes also had the same effect.

The only way for it to work would be if the app first set the server
authentication method and then the client keys.  There's no good reason
for this.

Adjust the connection to only clear the server id methods and leave the
client ID untouched.

Fixes #7455
2020-07-17 14:02:17 -07:00
kinafu
709ba7981e
Change BSSL_CertStore test URL (#7370)
github.com forwards to www.github.com
So reaching out for "www.github.com" returns HTTP 304 instead of the nice HTTP 204
2020-07-16 12:07:40 -07:00
david gauchard
af1bc71a9e
remove lwip-v1.4 specific code (#7436)
* remove lwip-v1.4 specific code

* ditto

* ditto

* fix ip4_addr definition

* CI: change debug builds to use IPv6, remove regular IPv6 builds

* ditto

* split pio CI in four (because they last twice the time of the other builds)

* remove option from pio

* remove lwIP-1.4 from doc

* restore pio CI splitting

* fix CI debug6 script

* ditto
2020-07-09 09:59:49 -07:00
Earle F. Philhower, III
70e4457041
Remove axTLS from code and documentation (#7437) 2020-07-09 09:21:38 -07:00
Mikael Bertze
f1651fba89
Ability to set connect timeout in WifiMulti->run (#7420)
* Adds timeout parameter to run

* Renaming varaible to connectTimeoutMs
2020-07-02 00:01:34 +02:00
Earle F. Philhower, III
d85ff6efc4
Add namespace to FS references in CertStore (#7413)
Fixes #7410
2020-06-29 10:30:06 -07:00
Earle F. Philhower, III
786a65402f
Update GitHub cert fingerprint in example (#7397)
The certificate was regenerated yet again, so update the FP in the
SSL validation example.

Fixes #7394
2020-06-21 13:34:31 -07:00
Develo
ab03add8d0
Fix oversight for ap gw (#7366) 2020-06-10 15:18:19 -04:00
Jonathan Dumaresq
5473656eac
Update ESP8266WiFiAP.cpp (#7363)
Fix the bad adress of the the AP if the settings are wrong
2020-06-08 16:41:25 -04:00
Earle F. Philhower, III
c5f60e31cd
Allocate BSSL stack for SigningVerifier (#7291)
The BearSSL SigningVerifier was moved to the 2nd stack because some uses
required much more stack than available on the normal stack.

Add a reference to the second stack on object creation (which will
allocate it, if there is no BSSL stack already allocated), and delete
that reference on exit.

Fixes #7288
2020-05-15 20:21:50 -07:00
Earle F. Philhower, III
83166f948b
Deprecate SPIFFS, move examples to LittleFS (#7263)
* Deprecate SPIFFS, move examples to LittleFS

SPIFFS has been a great filesystem, but it has significant problems in
many cases (and it's also pretty slow).  Development seems to have
slowed/stopped on the upstream version, and we're not able to provide
support or fix the known issues with it as-is.

Deprecate SPIFFS variable.

Update all examples to use LittleFS instead of SPIFFS.

Also, minor cleanup on very old examples which has obsolete delays
waiting for the Serial port to come up, or which were stuck at 9600 baud
because of their ancient AVR heritage.

Fixes #7095

* Remove leftover debug code

* Clean up comments in some examples

* Update documentation on SPIFFS deprecation

* Fix host tests to avoid deprecation warnings

* Fix cut-n-paste error

* Restore SpeedTest.ino, adjust to allow custom FSes

Co-authored-by: Develo <deveyes@gmail.com>
2020-05-04 14:22:50 -04:00
Earle F. Philhower, III
388d3020f2
Fix minor GCC10 static analyzer warnings (#7255)
Add minor NULL and double-free checks to source, identified using GCC10
pre-release static `-fanalyzer` on the coude.  These are harmless to
other versions.

Also add explicit include of stdint to Schedule.h, because libstdc++20
will not automatically include it.  Safe and no-op on earlier versions.
2020-04-30 18:25:31 -07:00
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