neard: move recipe and patches to the proper dir
[scm/bb/meta-tizen.git] / meta-tizen-adaptation / meta-oe / recipes-connectivity / connman / connman / 0021-Tethering-Add-hidden-access-point-support-in-technol.patch
1 From cdc3af7c29f82b71c2ce76fb6aa28dd6b3d9e5cd Mon Sep 17 00:00:00 2001
2 From: Chengyi Zhao <chengyi1.zhao@archermind.com>
3 Date: Thu, 11 Jul 2013 10:00:31 +0800
4 Subject: [PATCH 21/32] Tethering: Add hidden access point support in
5  technology
6
7 Change-Id: I73fccf5f322ee2597f8f58d5e3d7f60ddeb0a641
8 ---
9  doc/technology-api.txt     |  5 +++++
10  gsupplicant/gsupplicant.h  |  7 +++++++
11  gsupplicant/supplicant.c   |  4 ++++
12  include/technology.h       |  2 +-
13  plugins/bluetooth.c        |  2 +-
14  plugins/bluetooth_legacy.c |  2 +-
15  plugins/ethernet.c         |  2 +-
16  plugins/gadget.c           |  2 +-
17  plugins/wifi.c             | 13 ++++++++++---
18  src/technology.c           | 33 ++++++++++++++++++++++++++++++++-
19  10 files changed, 63 insertions(+), 9 deletions(-)
20
21 diff --git a/doc/technology-api.txt b/doc/technology-api.txt
22 index f97eac0..2fbc876 100644
23 --- a/doc/technology-api.txt
24 +++ b/doc/technology-api.txt
25 @@ -97,3 +97,8 @@ Properties    boolean Powered [readwrite]
26                         This property is only valid for the WiFi technology,
27                         and is then mapped to the WPA pre-shared key clients
28                         will have to use in order to establish a connection.
29 +
30 +               boolean Hidden [readwrite]
31 +
32 +                       This option allows to enable or disable the support
33 +                       for the hidden Wi-Fi tethering.
34 diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
35 index 1fab1ba..c5dad72 100644
36 --- a/gsupplicant/gsupplicant.h
37 +++ b/gsupplicant/gsupplicant.h
38 @@ -129,6 +129,12 @@ typedef enum {
39         G_SUPPLICANT_PEER_GROUP_FAILED,
40  } GSupplicantPeerState;
41  
42 +enum GSupplicantAPHiddenSSID {
43 +       G_SUPPLICANT_AP_NO_SSID_HIDING,
44 +       G_SUPPLICANT_AP_HIDDEN_SSID_ZERO_LEN,
45 +       G_SUPPLICANT_AP_HIDDEN_SSID_ZERO_CONTENTS,
46 +};
47 +
48  struct _GSupplicantSSID {
49         const void *ssid;
50         unsigned int ssid_len;
51 @@ -150,6 +156,7 @@ struct _GSupplicantSSID {
52         dbus_bool_t use_wps;
53         const char *pin_wps;
54         const char *bgscan;
55 +       int ignore_broadcast_ssid;
56  };
57  
58  typedef struct _GSupplicantSSID GSupplicantSSID;
59 diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
60 index 5ff9b3d..59bf279 100644
61 --- a/gsupplicant/supplicant.c
62 +++ b/gsupplicant/supplicant.c
63 @@ -4659,6 +4659,10 @@ static void interface_add_network_params(DBusMessageIter *iter, void *user_data)
64                                         DBUS_TYPE_BYTE, &ssid->ssid,
65                                                 ssid->ssid_len);
66  
67 +       supplicant_dbus_dict_append_basic(&dict, "ignore_broadcast_ssid",
68 +                                       DBUS_TYPE_INT32,
69 +                                       &ssid->ignore_broadcast_ssid);
70 +
71         supplicant_dbus_dict_close(iter, &dict);
72  }
73  
74 diff --git a/include/technology.h b/include/technology.h
75 index b13d4ec..8efe9e7 100644
76 --- a/include/technology.h
77 +++ b/include/technology.h
78 @@ -63,7 +63,7 @@ struct connman_technology_driver {
79                                                                 int index);
80         int (*set_tethering) (struct connman_technology *technology,
81                                 const char *identifier, const char *passphrase,
82 -                               const char *bridge, bool enabled);
83 +                               const char *bridge, bool enabled, bool hidden);
84         int (*set_regdom) (struct connman_technology *technology,
85                                                 const char *alpha2);
86  };
87 diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
88 index 28df406..f8abeac 100644
89 --- a/plugins/bluetooth.c
90 +++ b/plugins/bluetooth.c
91 @@ -854,7 +854,7 @@ static void bluetooth_tech_remove(struct connman_technology *technology)
92  
93  static int bluetooth_tech_set_tethering(struct connman_technology *technology,
94                 const char *identifier, const char *passphrase,
95 -               const char *bridge, bool enabled)
96 +               const char *bridge, bool enabled, bool hidden)
97  {
98         GHashTableIter hash_iter;
99         gpointer key, value;
100 diff --git a/plugins/bluetooth_legacy.c b/plugins/bluetooth_legacy.c
101 index 2d7a9e0..a9ff574 100644
102 --- a/plugins/bluetooth_legacy.c
103 +++ b/plugins/bluetooth_legacy.c
104 @@ -1234,7 +1234,7 @@ static void disable_nap(gpointer key, gpointer value, gpointer user_data)
105  
106  static int tech_set_tethering(struct connman_technology *technology,
107                                 const char *identifier, const char *passphrase,
108 -                               const char *bridge, bool enabled)
109 +                               const char *bridge, bool enabled, bool hidden)
110  {
111         struct tethering_info info = {
112                 .technology     = technology,
113 diff --git a/plugins/ethernet.c b/plugins/ethernet.c
114 index b8e52ce..4e71346 100644
115 --- a/plugins/ethernet.c
116 +++ b/plugins/ethernet.c
117 @@ -309,7 +309,7 @@ static void eth_tech_disable_tethering(struct connman_technology *technology,
118  
119  static int eth_tech_set_tethering(struct connman_technology *technology,
120                                 const char *identifier, const char *passphrase,
121 -                               const char *bridge, bool enabled)
122 +                               const char *bridge, bool enabled, bool hidden)
123  {
124         if (!connman_technology_is_tethering_allowed(
125                         CONNMAN_SERVICE_TYPE_ETHERNET))
126 diff --git a/plugins/gadget.c b/plugins/gadget.c
127 index 94f6648..97807d8 100644
128 --- a/plugins/gadget.c
129 +++ b/plugins/gadget.c
130 @@ -291,7 +291,7 @@ static void gadget_tech_disable_tethering(struct connman_technology *technology,
131  
132  static int gadget_tech_set_tethering(struct connman_technology *technology,
133                                 const char *identifier, const char *passphrase,
134 -                               const char *bridge, bool enabled)
135 +                               const char *bridge, bool enabled, bool hidden)
136  {
137         DBG("bridge %s enabled %d", bridge, enabled);
138  
139 diff --git a/plugins/wifi.c b/plugins/wifi.c
140 index b5bc3ba..21f9912 100644
141 --- a/plugins/wifi.c
142 +++ b/plugins/wifi.c
143 @@ -2927,7 +2927,8 @@ struct wifi_tethering_info {
144         GSupplicantSSID *ssid;
145  };
146  
147 -static GSupplicantSSID *ssid_ap_init(const char *ssid, const char *passphrase)
148 +static GSupplicantSSID *ssid_ap_init(const char *ssid,
149 +               const char *passphrase, bool hidden)
150  {
151         GSupplicantSSID *ap;
152  
153 @@ -2952,6 +2953,12 @@ static GSupplicantSSID *ssid_ap_init(const char *ssid, const char *passphrase)
154                ap->passphrase = passphrase;
155         }
156  
157 +       if (hidden)
158 +               ap->ignore_broadcast_ssid =
159 +                               G_SUPPLICANT_AP_HIDDEN_SSID_ZERO_CONTENTS;
160 +       else
161 +               ap->ignore_broadcast_ssid = G_SUPPLICANT_AP_NO_SSID_HIDING;
162 +
163         return ap;
164  }
165  
166 @@ -3032,7 +3039,7 @@ static void sta_remove_callback(int result,
167  
168  static int tech_set_tethering(struct connman_technology *technology,
169                                 const char *identifier, const char *passphrase,
170 -                               const char *bridge, bool enabled)
171 +                               const char *bridge, bool enabled, bool hidden)
172  {
173         GList *list;
174         GSupplicantInterface *interface;
175 @@ -3085,7 +3092,7 @@ static int tech_set_tethering(struct connman_technology *technology,
176                 info->wifi = wifi;
177                 info->technology = technology;
178                 info->wifi->bridge = bridge;
179 -               info->ssid = ssid_ap_init(identifier, passphrase);
180 +               info->ssid = ssid_ap_init(identifier, passphrase, hidden);
181                 if (!info->ssid) {
182                         g_free(info);
183                         continue;
184 diff --git a/src/technology.c b/src/technology.c
185 index be66c3a..679c779 100644
186 --- a/src/technology.c
187 +++ b/src/technology.c
188 @@ -66,6 +66,7 @@ struct connman_technology {
189                                               */
190         char *tethering_ident;
191         char *tethering_passphrase;
192 +       bool tethering_hidden;
193  
194         bool enable_persistent; /* Save the tech state */
195  
196 @@ -177,6 +178,9 @@ static void technology_save(struct connman_technology *technology)
197         g_key_file_set_boolean(keyfile, identifier, "Tethering",
198                                 technology->tethering_persistent);
199  
200 +       g_key_file_set_boolean(keyfile, identifier, "Hidden",
201 +                               technology->tethering_hidden);
202 +
203         if (technology->tethering_ident)
204                 g_key_file_set_string(keyfile, identifier,
205                                         "Tethering.Identifier",
206 @@ -233,9 +237,11 @@ static int set_tethering(struct connman_technology *technology,
207         int err;
208         const char *ident, *passphrase, *bridge;
209         GSList *tech_drivers;
210 +       bool hidden;
211  
212         ident = technology->tethering_ident;
213         passphrase = technology->tethering_passphrase;
214 +       hidden = technology->tethering_hidden;
215  
216         __sync_synchronize();
217         if (!technology->enabled)
218 @@ -256,7 +262,7 @@ static int set_tethering(struct connman_technology *technology,
219                         continue;
220  
221                 err = driver->set_tethering(technology, ident, passphrase,
222 -                               bridge, enabled);
223 +                               bridge, enabled, hidden);
224  
225                 if (result == -EINPROGRESS)
226                         continue;
227 @@ -523,6 +529,11 @@ static void append_properties(DBusMessageIter *iter,
228                                         DBUS_TYPE_STRING,
229                                         &technology->tethering_passphrase);
230  
231 +       val = technology->tethering_hidden;
232 +       connman_dbus_dict_append_basic(&dict, "Hidden",
233 +                                       DBUS_TYPE_BOOLEAN,
234 +                                       &val);
235 +
236         connman_dbus_dict_close(iter, &dict);
237  }
238  
239 @@ -936,6 +947,25 @@ static DBusMessage *set_property(DBusConnection *conn,
240                                                 &technology->tethering_passphrase);
241                         }
242                 }
243 +       } else if (g_str_equal(name, "Hidden")) {
244 +               dbus_bool_t hidden;
245 +
246 +               if (type != DBUS_TYPE_BOOLEAN)
247 +                       return __connman_error_invalid_arguments(msg);
248 +
249 +               dbus_message_iter_get_basic(&value, &hidden);
250 +
251 +               if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
252 +                       return __connman_error_not_supported(msg);
253 +
254 +               technology->tethering_hidden = hidden;
255 +               technology_save(technology);
256 +
257 +               connman_dbus_property_changed_basic(technology->path,
258 +                                       CONNMAN_TECHNOLOGY_INTERFACE,
259 +                                       "Hidden",
260 +                                       DBUS_TYPE_BOOLEAN,
261 +                                       &hidden);
262         } else if (g_str_equal(name, "Powered")) {
263                 dbus_bool_t enable;
264  
265 @@ -1204,6 +1234,7 @@ static struct connman_technology *technology_get(enum connman_service_type type)
266  
267         technology->refcount = 1;
268         technology->type = type;
269 +       technology->tethering_hidden = FALSE;
270         technology->path = g_strdup_printf("%s/technology/%s",
271                                                         CONNMAN_PATH, str);
272         if (type == CONNMAN_SERVICE_TYPE_P2P) {
273 -- 
274 1.8.1.4
275