Skip to content

Commit

Permalink
Disable WPA entrprise on ESP8266 by default
Browse files Browse the repository at this point in the history
CL: wifi: Disable WPA entrprise on ESP8266 by default.
    It's not viable anyway due to huge memory usage and is also buggy (crashes).
    If you really want it, re-enable with MGOS_ESP8266_WIFI_ENABLE_WPAENT cdef,
    otherwise enjoy extra 60K of space.
  • Loading branch information
rojer committed Jan 27, 2020
1 parent bdc9eed commit c7c4634
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ config_schema:
build_vars:
MGOS_WIFI_ENABLE_AP_STA: 0

cdefs:
# WPA enterprise does not work properly on ESP8266 anyway due to lack of resources.
# But if you insist, you can override this to 1.
MGOS_ESP8266_WIFI_ENABLE_WPAENT: 0

conds:
- when: mos.platform == "cc3200"
apply:
Expand Down
9 changes: 9 additions & 0 deletions src/esp8266/esp_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
#include <esp_common.h>
#else
#include <user_interface.h>
#if MGOS_ESP8266_WIFI_ENABLE_WPAENT
#include <wpa2_enterprise.h>
#endif
#endif

#include "common/cs_dbg.h"
#include "common/cs_file.h"
Expand Down Expand Up @@ -204,6 +206,9 @@ bool mgos_wifi_dev_sta_setup(const struct mgos_config_wifi_sta *cfg) {
wifi_station_set_reconnect_policy(0); /* We manage reconnect ourselves */

if (!mgos_conf_str_empty(cfg->cert) || !mgos_conf_str_empty(cfg->user)) {
/* WPA enterprise does not work properly on ESP8266 anyway due to lack of
* resources. */
#if MGOS_ESP8266_WIFI_ENABLE_WPAENT
/* WPA-enterprise mode */
static char *s_ca_cert_pem = NULL, *s_cert_pem = NULL, *s_key_pem = NULL;

Expand Down Expand Up @@ -261,6 +266,10 @@ bool mgos_wifi_dev_sta_setup(const struct mgos_config_wifi_sta *cfg) {
wifi_station_set_wpa2_enterprise_auth(true /* enable */);
} else {
wifi_station_set_wpa2_enterprise_auth(false /* enable */);
#else
LOG(LL_ERROR, ("WPA entrprise not supported, rebuild with "
"MGOS_ESP8266_WIFI_ENABLE_WPAENT"));
#endif
}

const char *host_name =
Expand Down

0 comments on commit c7c4634

Please sign in to comment.