summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChengyi Zhao <chengyi1.zhao@archermind.com>2013-07-11 02:00:31 (GMT)
committerZhang zhengguang <zhengguang.zhang@intel.com>2014-07-31 07:51:58 (GMT)
commitff893fedd30baba89fdffd8cc9bac367ebf18ad1 (patch)
treee6b046df1e4c01982d6e5032005d96486a4cc602
parentdd9f5cf8bbc5df71d9378f0a8a0f89d5ddc42d8b (diff)
downloadconnman-ff893fedd30baba89fdffd8cc9bac367ebf18ad1.zip
connman-ff893fedd30baba89fdffd8cc9bac367ebf18ad1.tar.gz
connman-ff893fedd30baba89fdffd8cc9bac367ebf18ad1.tar.bz2
Tethering: Add hidden access point support in technology
Change-Id: I73fccf5f322ee2597f8f58d5e3d7f60ddeb0a641
-rw-r--r--doc/technology-api.txt5
-rw-r--r--gsupplicant/gsupplicant.h7
-rw-r--r--gsupplicant/supplicant.c4
-rw-r--r--include/technology.h2
-rw-r--r--plugins/bluetooth.c2
-rw-r--r--plugins/bluetooth_legacy.c2
-rw-r--r--plugins/ethernet.c2
-rw-r--r--plugins/wifi.c13
-rw-r--r--src/technology.c33
9 files changed, 62 insertions, 8 deletions
diff --git a/doc/technology-api.txt b/doc/technology-api.txt
index f97eac0..2fbc876 100644
--- a/doc/technology-api.txt
+++ b/doc/technology-api.txt
@@ -97,3 +97,8 @@ Properties boolean Powered [readwrite]
This property is only valid for the WiFi technology,
and is then mapped to the WPA pre-shared key clients
will have to use in order to establish a connection.
+
+ boolean Hidden [readwrite]
+
+ This option allows to enable or disable the support
+ for the hidden Wi-Fi tethering.
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 83cb485..bb4acd3 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -113,6 +113,12 @@ typedef enum {
G_SUPPLICANT_WPS_STATE_FAIL,
} GSupplicantWpsState;
+enum GSupplicantAPHiddenSSID {
+ G_SUPPLICANT_AP_NO_SSID_HIDING,
+ G_SUPPLICANT_AP_HIDDEN_SSID_ZERO_LEN,
+ G_SUPPLICANT_AP_HIDDEN_SSID_ZERO_CONTENTS,
+} ;
+
struct _GSupplicantSSID {
const void *ssid;
unsigned int ssid_len;
@@ -134,6 +140,7 @@ struct _GSupplicantSSID {
dbus_bool_t use_wps;
const char *pin_wps;
const char *bgscan;
+ int ignore_broadcast_ssid;
};
typedef struct _GSupplicantSSID GSupplicantSSID;
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index b6f3cd3..5642ae4 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -3922,6 +3922,10 @@ static void interface_add_network_params(DBusMessageIter *iter, void *user_data)
DBUS_TYPE_BYTE, &ssid->ssid,
ssid->ssid_len);
+ supplicant_dbus_dict_append_basic(&dict, "ignore_broadcast_ssid",
+ DBUS_TYPE_INT32,
+ &ssid->ignore_broadcast_ssid);
+
supplicant_dbus_dict_close(iter, &dict);
}
diff --git a/include/technology.h b/include/technology.h
index b13d4ec..8efe9e7 100644
--- a/include/technology.h
+++ b/include/technology.h
@@ -63,7 +63,7 @@ struct connman_technology_driver {
int index);
int (*set_tethering) (struct connman_technology *technology,
const char *identifier, const char *passphrase,
- const char *bridge, bool enabled);
+ const char *bridge, bool enabled, bool hidden);
int (*set_regdom) (struct connman_technology *technology,
const char *alpha2);
};
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 28df406..f8abeac 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -854,7 +854,7 @@ static void bluetooth_tech_remove(struct connman_technology *technology)
static int bluetooth_tech_set_tethering(struct connman_technology *technology,
const char *identifier, const char *passphrase,
- const char *bridge, bool enabled)
+ const char *bridge, bool enabled, bool hidden)
{
GHashTableIter hash_iter;
gpointer key, value;
diff --git a/plugins/bluetooth_legacy.c b/plugins/bluetooth_legacy.c
index 2d7a9e0..a9ff574 100644
--- a/plugins/bluetooth_legacy.c
+++ b/plugins/bluetooth_legacy.c
@@ -1234,7 +1234,7 @@ static void disable_nap(gpointer key, gpointer value, gpointer user_data)
static int tech_set_tethering(struct connman_technology *technology,
const char *identifier, const char *passphrase,
- const char *bridge, bool enabled)
+ const char *bridge, bool enabled, bool hidden)
{
struct tethering_info info = {
.technology = technology,
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index b8e52ce..4e71346 100644
--- a/plugins/ethernet.c
+++ b/plugins/ethernet.c
@@ -309,7 +309,7 @@ static void eth_tech_disable_tethering(struct connman_technology *technology,
static int eth_tech_set_tethering(struct connman_technology *technology,
const char *identifier, const char *passphrase,
- const char *bridge, bool enabled)
+ const char *bridge, bool enabled, bool hidden)
{
if (!connman_technology_is_tethering_allowed(
CONNMAN_SERVICE_TYPE_ETHERNET))
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 8ac6c07..e3e3f97 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2184,7 +2184,8 @@ struct wifi_tethering_info {
GSupplicantSSID *ssid;
};
-static GSupplicantSSID *ssid_ap_init(const char *ssid, const char *passphrase)
+static GSupplicantSSID *ssid_ap_init(const char *ssid,
+ const char *passphrase, bool hidden)
{
GSupplicantSSID *ap;
@@ -2209,6 +2210,12 @@ static GSupplicantSSID *ssid_ap_init(const char *ssid, const char *passphrase)
ap->passphrase = passphrase;
}
+ if (hidden)
+ ap->ignore_broadcast_ssid =
+ G_SUPPLICANT_AP_HIDDEN_SSID_ZERO_CONTENTS;
+ else
+ ap->ignore_broadcast_ssid = G_SUPPLICANT_AP_NO_SSID_HIDING;
+
return ap;
}
@@ -2289,7 +2296,7 @@ static void sta_remove_callback(int result,
static int tech_set_tethering(struct connman_technology *technology,
const char *identifier, const char *passphrase,
- const char *bridge, bool enabled)
+ const char *bridge, bool enabled, bool hidden)
{
GList *list;
GSupplicantInterface *interface;
@@ -2342,7 +2349,7 @@ static int tech_set_tethering(struct connman_technology *technology,
info->wifi = wifi;
info->technology = technology;
info->wifi->bridge = bridge;
- info->ssid = ssid_ap_init(identifier, passphrase);
+ info->ssid = ssid_ap_init(identifier, passphrase, hidden);
if (!info->ssid) {
g_free(info);
continue;
diff --git a/src/technology.c b/src/technology.c
index be66c3a..b6e8b49 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -66,6 +66,7 @@ struct connman_technology {
*/
char *tethering_ident;
char *tethering_passphrase;
+ bool tethering_hidden;
bool enable_persistent; /* Save the tech state */
@@ -177,6 +178,9 @@ static void technology_save(struct connman_technology *technology)
g_key_file_set_boolean(keyfile, identifier, "Tethering",
technology->tethering_persistent);
+ g_key_file_set_boolean(keyfile, identifier, "Hidden",
+ technology->tethering_hidden);
+
if (technology->tethering_ident)
g_key_file_set_string(keyfile, identifier,
"Tethering.Identifier",
@@ -233,9 +237,11 @@ static int set_tethering(struct connman_technology *technology,
int err;
const char *ident, *passphrase, *bridge;
GSList *tech_drivers;
+ bool hidden;
ident = technology->tethering_ident;
passphrase = technology->tethering_passphrase;
+ hidden = technology->tethering_hidden;
__sync_synchronize();
if (!technology->enabled)
@@ -256,7 +262,7 @@ static int set_tethering(struct connman_technology *technology,
continue;
err = driver->set_tethering(technology, ident, passphrase,
- bridge, enabled);
+ bridge, enabled, hidden);
if (result == -EINPROGRESS)
continue;
@@ -523,6 +529,11 @@ static void append_properties(DBusMessageIter *iter,
DBUS_TYPE_STRING,
&technology->tethering_passphrase);
+ val = technology->tethering_hidden;
+ connman_dbus_dict_append_basic(&dict, "Hidden",
+ DBUS_TYPE_BOOLEAN,
+ &val);
+
connman_dbus_dict_close(iter, &dict);
}
@@ -936,6 +947,25 @@ static DBusMessage *set_property(DBusConnection *conn,
&technology->tethering_passphrase);
}
}
+ } else if (g_str_equal(name, "Hidden")) {
+ bool hidden;
+
+ if (type != DBUS_TYPE_BOOLEAN)
+ return __connman_error_invalid_arguments(msg);
+
+ dbus_message_iter_get_basic(&value, &hidden);
+
+ if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
+ return __connman_error_not_supported(msg);
+
+ technology->tethering_hidden = hidden;
+ technology_save(technology);
+
+ connman_dbus_property_changed_basic(technology->path,
+ CONNMAN_TECHNOLOGY_INTERFACE,
+ "Hidden",
+ DBUS_TYPE_BOOLEAN,
+ &technology->tethering_hidden);
} else if (g_str_equal(name, "Powered")) {
dbus_bool_t enable;
@@ -1204,6 +1234,7 @@ static struct connman_technology *technology_get(enum connman_service_type type)
technology->refcount = 1;
technology->type = type;
+ technology->tethering_hidden = FALSE;
technology->path = g_strdup_printf("%s/technology/%s",
CONNMAN_PATH, str);
if (type == CONNMAN_SERVICE_TYPE_P2P) {