diff --git a/build/openwrt/makefile b/build/openwrt/makefile index c70a1899b..aec14973b 100644 --- a/build/openwrt/makefile +++ b/build/openwrt/makefile @@ -32,6 +32,7 @@ include makefile.inc EASY_MESH_NODE = 1 EM_APP = 1 ONEWIFI_STA_MGR_APP_SUPPORT = 1 +ONEWIFI_EASYCONNECT_APP_SUPPORT = 1 # wifi hal rules HAL_LIBRARY = $(INSTALLDIR)/lib/libwifihal.a @@ -489,7 +490,7 @@ ALL_HEBUS_LIB_OBJECTS = $(HEBUS_OBJECTS) ALLOBJECTS = $(CXXOBJECTS) $(COBJECTS) $(WEBCONFIG_OBJECTS) $(HEBUS_OBJECTS) CFLAGS += $(INCLUDEDIRS) $(INCLUDE_HE_LIB_DIRS) -g -Os -fPIC -D_ANSC_LINUX -D_COSA_INTEL_USG_ATOM_ -DUSE_NOTIFY_COMPONENT -DCISCO_XB3_PLATFORM_CHANGES -DDUAL_CORE_XB3 -DFEATURE_ONE_WIFI -DWIFI_HAL_VERSION_3 -DFEATURE_SUPPORT_PASSPOINT -DFEATURE_SUPPORT_WEBCONFIG -DBANANA_PI_PORT -DNL80211_ACL -D_PLATFORM_BANANAPI_R4_ -DFEATURE_SINGLE_PHY -DEASY_MESH_NODE -DEM_APP \ - -DONEWIFI_STA_MGR_APP_SUPPORT + -DONEWIFI_STA_MGR_APP_SUPPORT -DONEWIFI_EASYCONNECT_APP_SUPPORT ifneq ($(OS), Darwin) CFLAGS += -DPLATFORM_LINUX diff --git a/include/wifi_base.h b/include/wifi_base.h index 27a195c85..13d035533 100644 --- a/include/wifi_base.h +++ b/include/wifi_base.h @@ -413,7 +413,7 @@ typedef struct { char wps_pin[10]; } __attribute__((__packed__)) wps_pin_config_t; -#define MAX_SCANNED_VAPS 32 +#define MAX_SCANNED_VAPS 200 typedef struct { unsigned int radio_index; diff --git a/source/core/wifi_ctrl.c b/source/core/wifi_ctrl.c index 6a95966fa..73bb827dc 100644 --- a/source/core/wifi_ctrl.c +++ b/source/core/wifi_ctrl.c @@ -1060,27 +1060,38 @@ int start_wifi_health_monitor_thread(void) int scan_results_callback(int radio_index, wifi_bss_info_t **bss, unsigned int *num) { - scan_results_t res; - - memset(&res, 0, sizeof(scan_results_t)); - - res.radio_index = radio_index; + scan_results_t *res; if (*num) { // if number of scanned AP's is more than size of res.bss array - truncate if (*num > MAX_SCANNED_VAPS){ *num = MAX_SCANNED_VAPS; } - res.num = *num; - memcpy((unsigned char *)res.bss, (unsigned char *)(*bss), (*num)*sizeof(wifi_bss_info_t)); } + + res = (scan_results_t *)calloc(1, sizeof(scan_results_t)); + if(!res) { + wifi_util_dbg_print(WIFI_CTRL,"%s:%d Failed to allocate memory for scan_results_t\n", __FUNCTION__, __LINE__); + return RETURN_ERR; + } + + res->radio_index = radio_index; + res->num = *num; + memcpy((unsigned char *)res->bss, (unsigned char *)(*bss), (*num)*sizeof(wifi_bss_info_t)); + if (is_sta_enabled()) { - push_event_to_ctrl_queue(&res, sizeof(scan_results_t), wifi_event_type_hal_ind, - wifi_event_scan_results, NULL); + if(push_event_to_ctrl_queue(res, sizeof(scan_results_t), wifi_event_type_hal_ind, + wifi_event_scan_results, NULL) != RETURN_OK) { + wifi_util_error_print(WIFI_CTRL,"%s:%d Failed to push scan_results to queue\n", __FUNCTION__, __LINE__); + free(*bss); + free(res); + return RETURN_ERR; + } } free(*bss); + free(res); - return 0; + return RETURN_OK; } void sta_connection_handler(const char *vif_name, wifi_bss_info_t *bss_info, wifi_station_stats_t *sta)