Tethering: Add hidden access point support in technology
[platform/upstream/connman.git] / plugins / wifi.c
index 69a0e23..21f9912 100644 (file)
@@ -2719,6 +2719,17 @@ static void apply_peer_services(GSupplicantPeer *peer,
        }
 }
 
+static void add_station(const char *mac)
+{
+       connman_technology_tethering_add_station(CONNMAN_SERVICE_TYPE_WIFI,
+                                                mac);
+}
+
+static void remove_station(const char *mac)
+{
+       connman_technology_tethering_remove_station(mac);
+}
+
 static void peer_found(GSupplicantPeer *peer)
 {
        GSupplicantInterface *iface = g_supplicant_peer_get_interface(peer);
@@ -2887,6 +2898,8 @@ static const GSupplicantCallbacks callbacks = {
        .network_added          = network_added,
        .network_removed        = network_removed,
        .network_changed        = network_changed,
+       .add_station            = add_station,
+       .remove_station         = remove_station,
        .peer_found             = peer_found,
        .peer_lost              = peer_lost,
        .peer_changed           = peer_changed,
@@ -2914,7 +2927,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;
 
@@ -2939,6 +2953,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;
 }
 
@@ -3019,7 +3039,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;
@@ -3072,7 +3092,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;