| Index: src/wifi.c
|
| diff --git a/src/wifi.c b/src/wifi.c
|
| index beecc8d200bbbae2c59e050ccdd1db4112442ba1..a8f22b0f6d7dda5f9d4cecc8b27855c2970cac7c 100644
|
| --- a/src/wifi.c
|
| +++ b/src/wifi.c
|
| @@ -27,8 +27,12 @@
|
|
|
| #include <glib.h>
|
|
|
| +#include <connman/blob.h>
|
| +
|
| #include "connman.h"
|
|
|
| +#define _DBG_WIFI(fmt, arg...) DBG(DBG_WIFI, fmt, ## arg)
|
| +
|
| static inline gboolean ispsk(const char *security)
|
| {
|
| return (g_strcmp0(security, "wpa") == 0 ||
|
| @@ -153,3 +157,61 @@ done:
|
|
|
| return g_string_free(str, FALSE);
|
| }
|
| +
|
| +/*
|
| + * NB: this knows a bit too much about how services are written to the profile.
|
| + */
|
| +static void append_hidden_ssids(GKeyFile *keyfile, GSList **hidden_ssids)
|
| +{
|
| + gchar **keys;
|
| +
|
| + keys = g_key_file_get_groups(keyfile, NULL);
|
| + if (keys == NULL) {
|
| + connman_warn("%s: unable to retrieve groups", __func__);
|
| + return;
|
| + }
|
| +
|
| + for (; *keys != NULL; keys++) {
|
| + gchar *key = *keys;
|
| + gchar *hex_ssid;
|
| + struct blob *ssid;
|
| + int ret;
|
| +
|
| + if (g_ascii_strncasecmp(key, "wifi_", 5) != 0)
|
| + continue;
|
| +
|
| + if (!g_key_file_get_boolean(keyfile, key, "WiFi.HiddenSSID",
|
| + NULL))
|
| + continue;
|
| +
|
| + hex_ssid = g_key_file_get_string(keyfile, key, "SSID", NULL);
|
| + if (hex_ssid == NULL)
|
| + continue;
|
| +
|
| + _DBG_WIFI("service %s", key);
|
| +
|
| + ret = blob_new_from_hex(&ssid, hex_ssid);
|
| + g_free(hex_ssid);
|
| + if (ret < 0) {
|
| + connman_warn("%s: skip hex ssid %s for key %s",
|
| + __func__, hex_ssid, key);
|
| + continue;
|
| + }
|
| +
|
| + _DBG_WIFI("ssid %.*s", ssid->len, ssid->data);
|
| + *hidden_ssids = g_slist_prepend(*hidden_ssids, ssid);
|
| + }
|
| +}
|
| +
|
| +/**
|
| + * connman_wifi_append_hidden_ssids:
|
| + * @ssids: pointer to a list of hidden SSIDs
|
| + *
|
| + * Append the list of SSIDs whose services whose WiFi.HiddenSSID property is
|
| + * TRUE. These SSIDs should be directly probed whenever performing a WiFi
|
| + * network scan.
|
| + */
|
| +void connman_wifi_append_hidden_ssids(GSList **ssids)
|
| +{
|
| + __connman_profile_append_hidden_ssids(ssids, append_hidden_ssids);
|
| +}
|
|
|