nfsd4: don't check ip address in setclientid
[safe/jmp/linux-2.6] / net / mac80211 / mlme.c
index 7600ac9..2b890af 100644 (file)
@@ -309,7 +309,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
                mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
                                                  IEEE80211_STYPE_ASSOC_REQ);
                mgmt->u.assoc_req.capab_info = cpu_to_le16(capab);
-               mgmt->u.reassoc_req.listen_interval =
+               mgmt->u.assoc_req.listen_interval =
                                cpu_to_le16(local->hw.conf.listen_interval);
        }
 
@@ -620,8 +620,8 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
        if (use_short_slot != bss_conf->use_short_slot) {
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
                if (net_ratelimit()) {
-                       printk(KERN_DEBUG "%s: switched to %s slot"
-                              " (BSSID=%s)\n",
+                       printk(KERN_DEBUG "%s: switched to %s slot time"
+                              " (BSSID=%pM)\n",
                               sdata->dev->name,
                               use_short_slot ? "short" : "long",
                               ifsta->bssid);
@@ -744,6 +744,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
        bss_info_changed |= BSS_CHANGED_BASIC_RATES;
        ieee80211_bss_info_change_notify(sdata, bss_info_changed);
 
+       if (local->powersave) {
+               if (local->dynamic_ps_timeout > 0)
+                       mod_timer(&local->dynamic_ps_timer, jiffies +
+                                 msecs_to_jiffies(local->dynamic_ps_timeout));
+               else {
+                       conf->flags |= IEEE80211_CONF_PS;
+                       ieee80211_hw_config(local,
+                                           IEEE80211_CONF_CHANGE_PS);
+               }
+       }
+
        netif_tx_start_all_queues(sdata->dev);
        netif_carrier_on(sdata->dev);
 
@@ -812,7 +823,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
 {
        struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
-       u32 changed = 0;
+       u32 changed = 0, config_changed = 0;
 
        rcu_read_lock();
 
@@ -855,16 +866,36 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT)
                ifsta->state = IEEE80211_STA_MLME_DISABLED;
 
-       sta_info_unlink(&sta);
-
        rcu_read_unlock();
 
-       sta_info_destroy(sta);
-
        local->hw.conf.ht.enabled = false;
-       ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_HT);
+       local->oper_channel_type = NL80211_CHAN_NO_HT;
+       config_changed |= IEEE80211_CONF_CHANGE_HT;
+
+       del_timer_sync(&local->dynamic_ps_timer);
+       cancel_work_sync(&local->dynamic_ps_enable_work);
 
+       if (local->hw.conf.flags & IEEE80211_CONF_PS) {
+               local->hw.conf.flags &= ~IEEE80211_CONF_PS;
+               config_changed |= IEEE80211_CONF_CHANGE_PS;
+       }
+
+       ieee80211_hw_config(local, config_changed);
        ieee80211_bss_info_change_notify(sdata, changed);
+
+       rcu_read_lock();
+
+       sta = sta_info_get(local, ifsta->bssid);
+       if (!sta) {
+               rcu_read_unlock();
+               return;
+       }
+
+       sta_info_unlink(&sta);
+
+       rcu_read_unlock();
+
+       sta_info_destroy(sta);
 }
 
 static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata)
@@ -1555,8 +1586,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
                                    (unsigned long long) sta->sta.supp_rates[band]);
 #endif
                } else {
-                       ieee80211_ibss_add_sta(sdata, NULL, mgmt->bssid,
-                                              mgmt->sa, supp_rates);
+                       ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates);
                }
 
                rcu_read_unlock();
@@ -1603,8 +1633,13 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
                         * e.g: at 1 MBit that means mactime is 192 usec earlier
                         * (=24 bytes * 8 usecs/byte) than the beacon timestamp.
                         */
-                       int rate = local->hw.wiphy->bands[band]->
+                       int rate;
+                       if (rx_status->flag & RX_FLAG_HT) {
+                               rate = 65; /* TODO: HT rates */
+                       } else {
+                               rate = local->hw.wiphy->bands[band]->
                                        bitrates[rx_status->rate_idx].bitrate;
+                       }
                        rx_timestamp = rx_status->mactime + (24 * 8 * 10 / rate);
                } else if (local && local->ops && local->ops->get_tsf)
                        /* second best option: get current TSF */
@@ -1628,9 +1663,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
                               sdata->dev->name, mgmt->bssid);
 #endif
                        ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss);
-                       ieee80211_ibss_add_sta(sdata, NULL,
-                                              mgmt->bssid, mgmt->sa,
-                                              supp_rates);
+                       ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates);
                }
        }
 
@@ -2002,7 +2035,7 @@ static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta,
                }
        }
 
-       if (hidden_ssid && ifsta->ssid_len == ssid_len)
+       if (hidden_ssid && (ifsta->ssid_len == ssid_len || ssid_len == 0))
                return 1;
 
        if (ssid_len == 1 && ssid[0] == ' ')
@@ -2363,8 +2396,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
  * must be callable in atomic context.
  */
 struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
-                                       struct sk_buff *skb, u8 *bssid,
-                                       u8 *addr, u64 supp_rates)
+                                       u8 *bssid,u8 *addr, u64 supp_rates)
 {
        struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
@@ -2570,3 +2602,39 @@ void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local)
                ieee80211_restart_sta_timer(sdata);
        rcu_read_unlock();
 }
+
+void ieee80211_dynamic_ps_disable_work(struct work_struct *work)
+{
+       struct ieee80211_local *local =
+               container_of(work, struct ieee80211_local,
+                            dynamic_ps_disable_work);
+
+       if (local->hw.conf.flags & IEEE80211_CONF_PS) {
+               local->hw.conf.flags &= ~IEEE80211_CONF_PS;
+               ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
+       }
+
+       ieee80211_wake_queues_by_reason(&local->hw,
+                                       IEEE80211_QUEUE_STOP_REASON_PS);
+}
+
+void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
+{
+       struct ieee80211_local *local =
+               container_of(work, struct ieee80211_local,
+                            dynamic_ps_enable_work);
+
+       if (local->hw.conf.flags & IEEE80211_CONF_PS)
+               return;
+
+       local->hw.conf.flags |= IEEE80211_CONF_PS;
+
+       ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
+}
+
+void ieee80211_dynamic_ps_timer(unsigned long data)
+{
+       struct ieee80211_local *local = (void *) data;
+
+       queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work);
+}