Skip to content

WiFiMulti won't work for an added SSID that is a hidden network #8217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
mahboud opened this issue May 17, 2023 · 1 comment · Fixed by #9202
Closed
1 task done

WiFiMulti won't work for an added SSID that is a hidden network #8217

mahboud opened this issue May 17, 2023 · 1 comment · Fixed by #9202
Labels
Area: BT&Wifi BT & Wifi related issues Status: To be implemented Selected for Development Type: Feature request Feature request for Arduino ESP32
Milestone

Comments

@mahboud
Copy link

mahboud commented May 17, 2023

Board

ESP32 boards

Device Description

Any ESP32

Hardware Configuration

Basic chip with WiFi, using WifiMulti

Version

latest master (checkout manually)

IDE Name

PlatformIO

Operating System

MacOS 13.3

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

115200

Description

When WiFi.scanNetworks runs, the results for networks that are hidden is to not return an SSID name. RSSI, BSSID, and other info is returned but no SSID.

When the APList items are compared to the SSID of that hidden network:

                for(uint32_t x = APlist.size() ; x > 0; x--) {
                    WifiAPlist_t entry = APlist[x-1];

                    if(ssid_scan == entry.ssid) { // SSID match  <======= For SSIDs that are hidden, ssid_scan is ""
                       …
                    }

There won't be a match. If we pass our SSID to WiFi.begin("hidden ssid name", "password"); that will work, but not with WiFiMulti.run() as the ssid added via WiFiMulti.addAP("hidden ssid name", "password") will never match the empty string that results from the scan.

Sketch

/*
 *  This sketch trys to Connect to the best AP based on a given list
 *
 */

#include <WiFi.h>
#include <WiFiMulti.h>

WiFiMulti wifiMulti;

void setup()
{
    Serial.begin(115200);
    delay(10);

    wifiMulti.addAP("hidden_SSID", "password1");  <=== This network never gets selected despite that AP is the stronger one. The AP is set to hide that network SSID.
    wifiMulti.addAP("ssid_2", "password2");

    Serial.println("Connecting Wifi...");
    if(wifiMulti.run() == WL_CONNECTED) {
        Serial.println("");
        Serial.println("WiFi connected");
        Serial.println("IP address: ");
        Serial.println(WiFi.localIP());
    }
}

void loop()
{
    if(wifiMulti.run() != WL_CONNECTED) {
        Serial.println("WiFi not connected!");
        delay(1000);
    }
}

Debug Message

Here is an output of a wifi scan. The first network is not hidden, and the second one is. Both networks are resident on the same AP (which somewhat explains the oddly similar BSSIDs).

[  5935][I][KiniNetworking.cpp:820] wifi_scan(): [scan] SSID            Kini Test Net
[  5942][I][KiniNetworking.cpp:821] wifi_scan(): [scan] RSSI            -56
[  5948][I][KiniNetworking.cpp:823] wifi_scan(): [scan] BSSID           18:E8:29:57:B5:4A
[  5955][I][KiniNetworking.cpp:721] print_auth_mode(): [scan] Authmode  WIFI_AUTH_WPA2_PSK
[  5963][I][KiniNetworking.cpp:756] print_cipher_type(): [scan] Pairwise Cipher         WIFI_CIPHER_TYPE_CCMP
[  5972][I][KiniNetworking.cpp:780] print_cipher_type(): [scan] Group Cipher    WIFI_CIPHER_TYPE_CCMP
[  5981][I][KiniNetworking.cpp:828] wifi_scan(): [scan] Channel                 1

[  5987][I][KiniNetworking.cpp:820] wifi_scan(): [scan] SSID 
[  5992][I][KiniNetworking.cpp:821] wifi_scan(): [scan] RSSI            -59
[  5998][I][KiniNetworking.cpp:823] wifi_scan(): [scan] BSSID           1E:E8:29:57:B5:4A
[  6005][I][KiniNetworking.cpp:721] print_auth_mode(): [scan] Authmode  WIFI_AUTH_WPA2_PSK
[  6013][I][KiniNetworking.cpp:756] print_cipher_type(): [scan] Pairwise Cipher         WIFI_CIPHER_TYPE_CCMP
[  6022][I][KiniNetworking.cpp:780] print_cipher_type(): [scan] Group Cipher    WIFI_CIPHER_TYPE_CCMP
[  6031][I][KiniNetworking.cpp:828] wifi_scan(): [scan] Channel                 1

Other Steps to Reproduce

Use WiFi.scanNetworks in an environment where you have hidden and unhidden SSID.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@mahboud mahboud added the Status: Awaiting triage Issue is waiting for triage label May 17, 2023
@SuGlider SuGlider added Type: Feature request Feature request for Arduino ESP32 Status: To be implemented Selected for Development Area: BT&Wifi BT & Wifi related issues and removed Status: Awaiting triage Issue is waiting for triage labels May 18, 2023
@SuGlider SuGlider self-assigned this May 18, 2023
@SuGlider
Copy link
Collaborator

@mahboud - This feature has been requested before in #7189.
Arduino team is currently working on IDF 5.1 refactoring for the new Arduino Core 3.0.0.

It may take some long time for us to work on it.
Please feel free to post a PR at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues Status: To be implemented Selected for Development Type: Feature request Feature request for Arduino ESP32
Projects
Development

Successfully merging a pull request may close this issue.

3 participants