From 6218b9263b97c73f1ecca71de204ba4d6ee812c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Fri, 23 Mar 2018 07:27:31 +0100 Subject: [PATCH] initialize new memebers in station_config and scan_config (#2309) Initialize new members in station_config and scan_config --- app/modules/enduser_setup.c | 2 ++ app/modules/wifi.c | 30 ++++++------------------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/app/modules/enduser_setup.c b/app/modules/enduser_setup.c index 2fe519cb..5cd47f63 100644 --- a/app/modules/enduser_setup.c +++ b/app/modules/enduser_setup.c @@ -664,6 +664,8 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data struct station_config *cnf = luaM_malloc(lua_getstate(), sizeof(struct station_config)); c_memset(cnf, 0, sizeof(struct station_config)); + cnf->threshold.rssi = -127; + cnf->threshold.authmode = AUTH_OPEN; int err; err = enduser_setup_http_urldecode(cnf->ssid, name_str_start, name_str_len, sizeof(cnf->ssid)); diff --git a/app/modules/wifi.c b/app/modules/wifi.c index 84f611f6..eb98adce 100644 --- a/app/modules/wifi.c +++ b/app/modules/wifi.c @@ -722,10 +722,7 @@ static int wifi_station_clear_config ( lua_State* L ) bool auto_connect=true; bool save_to_flash=true; - memset(sta_conf.ssid, 0, sizeof(sta_conf.ssid)); - memset(sta_conf.password, 0, sizeof(sta_conf.password)); - memset(sta_conf.bssid, 0, sizeof(sta_conf.bssid)); - sta_conf.bssid_set=0; + memset(&sta_conf, 0, sizeof(sta_conf)); wifi_station_disconnect(); @@ -753,10 +750,9 @@ static int wifi_station_config( lua_State* L ) bool save_to_flash=true; size_t sl, pl, ml; - memset(sta_conf.ssid, 0, sizeof(sta_conf.ssid)); - memset(sta_conf.password, 0, sizeof(sta_conf.password)); - memset(sta_conf.bssid, 0, sizeof(sta_conf.bssid)); - sta_conf.bssid_set=0; + memset(&sta_conf, 0, sizeof(sta_conf)); + sta_conf.threshold.rssi = -127; + sta_conf.threshold.authmode = AUTH_OPEN; if(lua_istable(L, 1)) { @@ -1032,6 +1028,8 @@ static int wifi_station_listap( lua_State* L ) return luaL_error( L, "Can't list ap in SOFTAP mode" ); } struct scan_config scan_cfg; + memset(&scan_cfg, 0, sizeof(scan_cfg)); + getap_output_format=0; if (lua_type(L, 1)==LUA_TTABLE) @@ -1061,10 +1059,6 @@ static int wifi_station_listap( lua_State* L ) return luaL_error( L, "wrong arg type" ); } } - else - { - scan_cfg.ssid=NULL; - } lua_getfield(L, 1, "bssid"); if (!lua_isnil(L, -1)) /* found? */ @@ -1085,10 +1079,6 @@ static int wifi_station_listap( lua_State* L ) return luaL_error( L, "wrong arg type" ); } } - else - { - scan_cfg.bssid=NULL; - } lua_getfield(L, 1, "channel"); @@ -1107,10 +1097,6 @@ static int wifi_station_listap( lua_State* L ) return luaL_error( L, "wrong arg type" ); } } - else - { - scan_cfg.channel=0; - } lua_getfield(L, 1, "show_hidden"); if (!lua_isnil(L, -1)) /* found? */ @@ -1129,10 +1115,6 @@ static int wifi_station_listap( lua_State* L ) return luaL_error( L, "wrong arg type" ); } } - else - { - scan_cfg.show_hidden=0; - } if (lua_type(L, 2) == LUA_TFUNCTION || lua_type(L, 2) == LUA_TLIGHTFUNCTION) {