summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChengyi Zhao <chengyi1.zhao@archermind.com>2013-07-11 10:00:31 +0800
committerZhang zhengguang <zhengguang.zhang@intel.com>2013-07-18 23:19:22 +0800
commit192bd0e3797292757ff69b0b098ad5688d575b60 (patch)
treed6222c2e1b7f9feb9ad0ef17d9664cef5c06f7f8
parent8912e481bb4ced41895865cc75da553d71992680 (diff)
downloadconnman-192bd0e3797292757ff69b0b098ad5688d575b60.tar.gz
connman-192bd0e3797292757ff69b0b098ad5688d575b60.tar.bz2
connman-192bd0e3797292757ff69b0b098ad5688d575b60.zip
Tethering: Add hidden access point support in technology
-rw-r--r--doc/technology-api.txt5
-rw-r--r--gsupplicant/gsupplicant.h7
-rw-r--r--gsupplicant/supplicant.c4
-rw-r--r--include/technology.h4
-rw-r--r--plugins/bluetooth.c3
-rw-r--r--plugins/bluetooth_legacy.c3
-rw-r--r--plugins/ethernet.c6
-rw-r--r--plugins/wifi.c14
-rw-r--r--src/technology.c23
9 files changed, 60 insertions, 9 deletions
diff --git a/doc/technology-api.txt b/doc/technology-api.txt
index 81adcbc7..e16f6fbe 100644
--- a/doc/technology-api.txt
+++ b/doc/technology-api.txt
@@ -93,3 +93,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 0cbbe027..bfba6cd1 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 c7bdeb82..db13ed6c 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -3600,6 +3600,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 b724cbfd..724f3aac 100644
--- a/include/technology.h
+++ b/include/technology.h
@@ -22,6 +22,7 @@
#ifndef __CONNMAN_TECHNOLOGY_H
#define __CONNMAN_TECHNOLOGY_H
+#include <stdbool.h>
#include <connman/service.h>
#ifdef __cplusplus
@@ -63,7 +64,8 @@ struct connman_technology_driver {
int index);
int (*set_tethering) (struct connman_technology *technology,
const char *identifier, const char *passphrase,
- const char *bridge, connman_bool_t enabled);
+ const char *bridge, connman_bool_t enabled,
+ bool hidden);
int (*set_regdom) (struct connman_technology *technology,
const char *alpha2);
};
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 4aac1e03..b5e310e1 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -826,7 +826,8 @@ 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, connman_bool_t enabled)
+ const char *bridge, connman_bool_t enabled,
+ bool hidden)
{
GHashTableIter hash_iter;
gpointer key, value;
diff --git a/plugins/bluetooth_legacy.c b/plugins/bluetooth_legacy.c
index 41438f44..8d7039b1 100644
--- a/plugins/bluetooth_legacy.c
+++ b/plugins/bluetooth_legacy.c
@@ -1225,7 +1225,8 @@ 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, connman_bool_t enabled)
+ const char *bridge, connman_bool_t enabled,
+ bool hidden)
{
struct tethering_info info = {
.technology = technology,
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index bafc75dd..eb242cac 100644
--- a/plugins/ethernet.c
+++ b/plugins/ethernet.c
@@ -284,7 +284,8 @@ static void disable_tethering(struct connman_technology *technology,
static int tech_set_tethering(struct connman_technology *technology,
const char *identifier, const char *passphrase,
- const char *bridge, connman_bool_t enabled)
+ const char *bridge, connman_bool_t enabled,
+ bool hidden)
{
DBG("bridge %s enabled %d", bridge, enabled);
@@ -400,7 +401,8 @@ static void eth_disable_tethering(struct connman_technology *technology,
static int eth_set_tethering(struct connman_technology *technology,
const char *identifier, const char *passphrase,
- const char *bridge, connman_bool_t enabled)
+ const char *bridge, connman_bool_t enabled,
+ bool hidden)
{
if (connman_technology_is_tethering_allowed(
CONNMAN_SERVICE_TYPE_ETHERNET) == FALSE)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index bbcb1df3..f34fa946 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1962,7 +1962,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;
@@ -1987,6 +1988,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;
}
@@ -2065,7 +2072,8 @@ 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, connman_bool_t enabled)
+ const char *bridge, connman_bool_t enabled,
+ bool hidden)
{
GList *list;
GSupplicantInterface *interface;
@@ -2118,7 +2126,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 == NULL) {
g_free(info);
continue;
diff --git a/src/technology.c b/src/technology.c
index faf5ae02..041e43e1 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <string.h>
+#include <stdbool.h>
#include <gdbus.h>
@@ -66,6 +67,7 @@ struct connman_technology {
*/
char *tethering_ident;
char *tethering_passphrase;
+ bool tethering_hidden;
connman_bool_t enable_persistent; /* Save the tech state */
@@ -316,9 +318,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 == FALSE)
@@ -339,7 +343,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;
@@ -602,6 +606,10 @@ static void append_properties(DBusMessageIter *iter,
DBUS_TYPE_STRING,
&technology->tethering_passphrase);
+ connman_dbus_dict_append_basic(&dict, "Hidden",
+ DBUS_TYPE_BOOLEAN,
+ &technology->tethering_hidden);
+
connman_dbus_dict_close(iter, &dict);
}
@@ -907,6 +915,18 @@ static DBusMessage *set_property(DBusConnection *conn,
&technology->tethering_passphrase);
}
}
+ } else if (g_str_equal(name, "Hidden") == TRUE) {
+ 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;
} else if (g_str_equal(name, "Powered") == TRUE) {
connman_bool_t enable;
@@ -1125,6 +1145,7 @@ static struct connman_technology *technology_get(enum connman_service_type type)
technology->rfkill_driven = FALSE;
technology->softblocked = FALSE;
technology->hardblocked = FALSE;
+ technology->tethering_hidden = false;
technology->type = type;
technology->path = g_strdup_printf("%s/technology/%s",