diff options
author | Jaehyun Kim <jeik01.kim@samsung.com> | 2023-11-30 02:18:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review> | 2023-11-30 02:18:13 +0000 |
commit | 3c4b0892bdece7badf7da09e50c0f2a8adb72f2d (patch) | |
tree | e9e8c9968914ee22043545368cb761ccf5486712 | |
parent | e4f197d465b1f55fb6e8809413d1af41361dce3f (diff) | |
parent | b6598eb8b174a0ee3c7b1dbc882d73f25c233a07 (diff) | |
download | connman-3c4b0892bdece7badf7da09e50c0f2a8adb72f2d.tar.gz connman-3c4b0892bdece7badf7da09e50c0f2a8adb72f2d.tar.bz2 connman-3c4b0892bdece7badf7da09e50c0f2a8adb72f2d.zip |
Merge "Save newly found APs through spec scan as hidden" into tizen_7.0accepted/tizen/7.0/unified/20231204.175243
-rwxr-xr-x | gsupplicant/gsupplicant.h | 7 | ||||
-rwxr-xr-x | plugins/wifi.c | 61 |
2 files changed, 68 insertions, 0 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index fc580347..bdd7c0ea 100755 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -249,10 +249,17 @@ typedef struct _GSupplicantSSID GSupplicantSSID; */ #define WPAS_MAX_SCAN_SSIDS 4 +#if defined TIZEN_EXT +struct scan_ssid { + unsigned char ssid[33]; + uint8_t ssid_len; +}; +#else struct scan_ssid { unsigned char ssid[32]; uint8_t ssid_len; }; +#endif struct _GSupplicantScanParams { GSList *ssids; diff --git a/plugins/wifi.c b/plugins/wifi.c index d7f4e88d..c1f9f5e5 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -211,6 +211,7 @@ struct wifi_data { unsigned int mac_policy; unsigned int preassoc_mac_policy; unsigned int mac_lifetime; + GSupplicantScanParams *specific_scan_params; #endif int disconnect_code; int assoc_code; @@ -3080,6 +3081,11 @@ static void specific_scan_callback(int result, GSupplicantInterface *interface, wifi->scan_params = NULL; } + if (wifi && wifi->specific_scan_params) { + g_supplicant_free_scan_params(wifi->specific_scan_params); + wifi->specific_scan_params = NULL; + } + scanning = connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_WIFI); if (scanning) { @@ -3091,6 +3097,22 @@ static void specific_scan_callback(int result, GSupplicantInterface *interface, start_roaming(wifi); } +static gpointer copy_ssid_list(gconstpointer src, gpointer data) +{ + struct scan_ssid *scan_ssid_src = (struct scan_ssid *) src; + struct scan_ssid *scan_ssid_ret; + + scan_ssid_ret = g_try_new0(struct scan_ssid, 1); + if (!scan_ssid_ret) { + DBG("Failed to allocate memory."); + return NULL; + } + + memcpy(scan_ssid_ret, scan_ssid_src, sizeof(struct scan_ssid)); + + return scan_ssid_ret; +} + static int wifi_specific_scan(enum connman_service_type type, struct connman_device *device, int scan_type, GSList *specific_scan_list, void *user_data) @@ -3237,6 +3259,15 @@ static int wifi_specific_scan(enum connman_service_type type, if (ret == 0) { connman_device_set_scanning(device, CONNMAN_SERVICE_TYPE_WIFI, true); + + wifi->specific_scan_params = g_try_malloc0(sizeof(GSupplicantScanParams)); + if (!wifi->specific_scan_params) { + DBG("Failed to allocate memory."); + return ret; + } + + wifi->specific_scan_params->ssids = + g_slist_copy_deep(scan_params->ssids, copy_ssid_list, NULL); } else { g_supplicant_free_scan_params(scan_params); connman_device_unref(device); @@ -5501,6 +5532,26 @@ static GSList *get_supported_security_list(unsigned int keymgmt, return sec_list; } + +static void check_specific_scan_ssids(struct wifi_data *wifi, + struct connman_network *network, const char *name) +{ + if (!wifi->specific_scan_params) + return; + + GSList *list; + + for (list = wifi->specific_scan_params->ssids; list; list = list->next) { + struct scan_ssid *scan_ssid = list->data; + struct connman_service *service; + + if (g_strcmp0(name, scan_ssid->ssid) != 0) + continue; + + service = connman_service_lookup_from_network(network); + __connman_service_set_hidden(service); + } +} #endif static void network_added(GSupplicantNetwork *supplicant_network) @@ -5518,6 +5569,7 @@ static void network_added(GSupplicantNetwork *supplicant_network) #if defined TIZEN_EXT bool owe_transition_mode; + bool network_created = false; const unsigned char *transition_mode_ssid; const unsigned char *transition_mode_bssid; unsigned int transition_mode_ssid_len; @@ -5586,6 +5638,10 @@ static void network_added(GSupplicantNetwork *supplicant_network) } wifi->networks = g_slist_prepend(wifi->networks, network); + +#if defined TIZEN_EXT + network_created = true; +#endif } if (name && name[0] != '\0') @@ -5708,6 +5764,11 @@ static void network_added(GSupplicantNetwork *supplicant_network) wifi->hidden = NULL; } } + +#if defined TIZEN_EXT + if (network_created) + check_specific_scan_ssids(wifi, network, name); +#endif } static void network_removed(GSupplicantNetwork *network) |