Skip to content

Commit

Permalink
Doc: Add doc about minimum security for connection to AP (#6909)
Browse files Browse the repository at this point in the history
* Add troubleshooting to connect to WEP/WPA APs.
* Add troubleshooting about WPA3 support.
  • Loading branch information
Rotzbua authored Jun 28, 2022
1 parent cb52e56 commit cf01523
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 6 deletions.
15 changes: 14 additions & 1 deletion docs/source/api/wifi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Wi-Fi API provides support for the 802.11b/g/n protocol driver. This API inc

* AP mode (aka Soft-AP mode or Access Point mode). Devices connect to the ESP32

* Security modes (WPA, WPA2, WEP, etc.)
* Security modes (WPA2, WPA3 etc.)

* Scanning for access points

Expand Down Expand Up @@ -477,6 +477,19 @@ Function used to get the automatic reconnection if the connection is lost.
The function will return ``true`` if this setting is enabled.

setMinSecurity
**************

Function used to set the minimum security for AP to be considered connectable.

.. code-block:: arduino
bool setMinSecurity(wifi_auth_mode_t minSecurity);
Where:

* ``minSecurity`` is the minimum security for AP to be considered connectable. Default is ``WIFI_AUTH_WPA2_PSK``.

WiFiMulti
---------

Expand Down
39 changes: 39 additions & 0 deletions docs/source/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,42 @@ Solution
* Change the USB port.
* Check your power supply.
* Check if the board is damaged or defective.

Wi-Fi
-----

Why does the board not connect to WEP/WPA-"encrypted" Wi-Fi?
************************************************************

Please note that WEP/WPA has significant security vulnerabilities and its use is strongly discouraged.
The support may therefore be removed in the future. Please migrate to WPA2 or newer.

Solution
^^^^^^^^

Nevertheless, it may be necessary to connect to insecure networks. To do this, the security requirement of the ESP32 must be lowered to an insecure level by using:

.. code-block:: arduino
WiFi.setMinSecurity(WIFI_AUTH_WEP); // Lower min security to WEP.
// or
WiFi.setMinSecurity(WIFI_AUTH_WPA_PSK); // Lower min security to WPA.
Why does the board not connect to WPA3-encrypted Wi-Fi?
*******************************************************

WPA3 support is resource intensive and may not be compiled into the used SDK.

Solution
^^^^^^^^

* Check WPA3 support by your SDK.
* Compile your custom SDK with WPA3 support.

Sample code to check SDK WPA3 support at compile time:

.. code-block:: arduino
#ifndef CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE
#warning "No WPA3 support."
#endif
11 changes: 6 additions & 5 deletions libraries/WiFi/src/WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,10 @@ bool WiFiSTAClass::reconnect()
}

/**
* Disconnect from the network
* @param wifioff
* @return one value of wl_status_t enum
* Disconnect from the network.
* @param wifioff `true` to turn the Wi-Fi radio off.
* @param eraseap `true` to erase the AP configuration from the NVS memory.
* @return `true` when successful.
*/
bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
{
Expand Down Expand Up @@ -398,8 +399,8 @@ bool WiFiSTAClass::isConnected()
}

/**
* Set the minimum security for AP to be considered connectable
* Must be called before WiFi.begin()
* Set the minimum security for AP to be considered connectable.
* Must be called before WiFi.begin().
* @param minSecurity wifi_auth_mode_t
*/
void WiFiSTAClass::setMinSecurity(wifi_auth_mode_t minSecurity)
Expand Down

0 comments on commit cf01523

Please sign in to comment.