Skip to content
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

ESP8266WiFiClass::begin Starts in STA + AP mode? #28

Closed
Links2004 opened this issue Apr 1, 2015 · 5 comments
Closed

ESP8266WiFiClass::begin Starts in STA + AP mode? #28

Links2004 opened this issue Apr 1, 2015 · 5 comments

Comments

@Links2004
Copy link
Collaborator

is there a reason for starting in WIFI_AP_STA mode?
in the default config the AP is "open" (no WPA2, no password), this can be a big risk of the security for the application or the network.

int ESP8266WiFiClass::begin(const char* ssid, const char *passphrase)
{
    if (wifi_get_opmode() == WIFI_AP)
    {
        // turn on AP+STA mode
        mode(WIFI_AP_STA);
    }

i preferred to only open the AP if the user really need it.

 mode(WIFI_STA);
@igrr
Copy link
Member

igrr commented Apr 1, 2015

We're only going from AP to AP_STA, we don't enable AP if it wasn't enabled previously.

Imagine the following code:

WiFi.softAP("esp", "password");
WiFi.begin("other_network", "whatever");

If we would just do mode(WIFI_STA) in begin this code would break.

@Links2004
Copy link
Collaborator Author

i never call softAP in my code only begin and i get an AP?

@igrr
Copy link
Member

igrr commented Apr 1, 2015

Yes, because the SDK libs store the WiFi configuration.
But I understand your point, I will add a flag to check whether softAP was called.

For now, please use WiFi.mode(WIFI_STA); as a workaround.

@Links2004
Copy link
Collaborator Author

ok thanks.

@Links2004
Copy link
Collaborator Author

fixed Links2004@3c7f046

igrr pushed a commit that referenced this issue Oct 29, 2015
igrr pushed a commit that referenced this issue Oct 29, 2015
 - begin changes
     allow setting BSSID/MAC and Channel of an AP for faster connection (#261)
     now checks if ssid and passphrase to big
     selecting Wifi mode in better way (fix for #28)

 - ESP8266WiFiMulti uses the new functions to auto select best AP even in a multi AP WiFi network (more the one AP has same SSID)

 - add new functions to get current Connected AP:
     uint8_t * BSSID(void);
     int32_t Channel(void);

 - add new functions to get infos from scanned networks:
     uint8_t * BSSID(uint8_t networkItem);
     int32_t Channel(uint8_t networkItem);
     bool isHidden(uint8_t networkItem);
     bool getNetworkInfo(uint8_t networkItem, const char** ssid, uint8_t * encryptionType, int32_t * RSSI, uint8_t ** BSSID, int32_t * channel, bool * isHidden);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants