mac80211: add ssid config to bss information in AP-mode
authorArik Nemtsov <arik@wizery.com>
Sun, 4 Sep 2011 08:11:32 +0000 (11:11 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 14 Sep 2011 17:56:26 +0000 (13:56 -0400)
Set SSID information from nl80211 beacon parameters. Advertise changes
in SSID to low level drivers.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/mac80211.h
net/mac80211/cfg.c
net/mac80211/util.c

index fc4806c6097f0baacb09c9158da9c0fb0786dc72..643e1291a1e8c2bb1e3e05b689c67c7f38f734f4 100644 (file)
@@ -164,6 +164,7 @@ struct ieee80211_low_level_stats {
  * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note
  *     that it is only ever disabled for station mode.
  * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
+ * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode)
  */
 enum ieee80211_bss_change {
        BSS_CHANGED_ASSOC               = 1<<0,
@@ -181,6 +182,7 @@ enum ieee80211_bss_change {
        BSS_CHANGED_ARP_FILTER          = 1<<12,
        BSS_CHANGED_QOS                 = 1<<13,
        BSS_CHANGED_IDLE                = 1<<14,
+       BSS_CHANGED_SSID                = 1<<15,
 
        /* when adding here, make sure to change ieee80211_reconfig */
 };
@@ -254,6 +256,9 @@ enum ieee80211_rssi_event {
  * @idle: This interface is idle. There's also a global idle flag in the
  *     hardware config which may be more appropriate depending on what
  *     your driver/device needs to do.
+ * @ssid: The SSID of the current vif. Only valid in AP-mode.
+ * @ssid_len: Length of SSID given in @ssid.
+ * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
  */
 struct ieee80211_bss_conf {
        const u8 *bssid;
@@ -280,6 +285,9 @@ struct ieee80211_bss_conf {
        bool arp_filter_enabled;
        bool qos;
        bool idle;
+       u8 ssid[IEEE80211_MAX_SSID_LEN];
+       size_t ssid_len;
+       bool hidden_ssid;
 };
 
 /**
index 5c0d8fab0e88e793481e30c946e69c60c6a46735..b57ddf941e598a121ea1197fcd857a6e05bb50b0 100644 (file)
@@ -455,6 +455,20 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
        return ret;
 }
 
+static void ieee80211_config_ap_ssid(struct ieee80211_sub_if_data *sdata,
+                                    struct beacon_parameters *params)
+{
+       struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
+
+       bss_conf->ssid_len = params->ssid_len;
+
+       if (params->ssid_len)
+               memcpy(bss_conf->ssid, params->ssid, params->ssid_len);
+
+       bss_conf->hidden_ssid =
+               (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE);
+}
+
 /*
  * This handles both adding a beacon and setting new beacon info
  */
@@ -548,8 +562,11 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
 
        kfree(old);
 
+       ieee80211_config_ap_ssid(sdata, params);
+
        ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |
-                                               BSS_CHANGED_BEACON);
+                                               BSS_CHANGED_BEACON |
+                                               BSS_CHANGED_SSID);
        return 0;
 }
 
index 1c1080274730799feb2a7aa10344e3c3846cbf03..4b1466d5b6a1da6bbbe286765c805d445c6465b8 100644 (file)
@@ -1077,6 +1077,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
                        changed |= BSS_CHANGED_IBSS;
                        /* fall through */
                case NL80211_IFTYPE_AP:
+                       changed |= BSS_CHANGED_SSID;
+                       /* fall through */
                case NL80211_IFTYPE_MESH_POINT:
                        changed |= BSS_CHANGED_BEACON |
                                   BSS_CHANGED_BEACON_ENABLED;
This page took 0.046893 seconds and 5 git commands to generate.