aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/mlme.c72
1 files changed, 33 insertions, 39 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index ec400479c5f6..9d51e278c1e5 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1615,6 +1615,7 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
1615 1615
1616 ieee80211_sta_def_wmm_params(sdata, bss); 1616 ieee80211_sta_def_wmm_params(sdata, bss);
1617 1617
1618 ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
1618 ifsta->state = IEEE80211_STA_MLME_IBSS_JOINED; 1619 ifsta->state = IEEE80211_STA_MLME_IBSS_JOINED;
1619 mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); 1620 mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL);
1620 1621
@@ -2178,19 +2179,18 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata,
2178 int i; 2179 int i;
2179 int ret; 2180 int ret;
2180 2181
2181#if 0 2182 if (sdata->u.sta.flags & IEEE80211_STA_BSSID_SET) {
2182 /* Easier testing, use fixed BSSID. */ 2183 memcpy(bssid, ifsta->bssid, ETH_ALEN);
2183 memset(bssid, 0xfe, ETH_ALEN); 2184 } else {
2184#else 2185 /* Generate random, not broadcast, locally administered BSSID. Mix in
2185 /* Generate random, not broadcast, locally administered BSSID. Mix in 2186 * own MAC address to make sure that devices that do not have proper
2186 * own MAC address to make sure that devices that do not have proper 2187 * random number generator get different BSSID. */
2187 * random number generator get different BSSID. */ 2188 get_random_bytes(bssid, ETH_ALEN);
2188 get_random_bytes(bssid, ETH_ALEN); 2189 for (i = 0; i < ETH_ALEN; i++)
2189 for (i = 0; i < ETH_ALEN; i++) 2190 bssid[i] ^= sdata->dev->dev_addr[i];
2190 bssid[i] ^= sdata->dev->dev_addr[i]; 2191 bssid[0] &= ~0x01;
2191 bssid[0] &= ~0x01; 2192 bssid[0] |= 0x02;
2192 bssid[0] |= 0x02; 2193 }
2193#endif
2194 2194
2195 printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", 2195 printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n",
2196 sdata->dev->name, bssid); 2196 sdata->dev->name, bssid);
@@ -2251,6 +2251,9 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2251 memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0 2251 memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0
2252 || !(bss->capability & WLAN_CAPABILITY_IBSS)) 2252 || !(bss->capability & WLAN_CAPABILITY_IBSS))
2253 continue; 2253 continue;
2254 if ((ifsta->flags & IEEE80211_STA_BSSID_SET) &&
2255 memcmp(ifsta->bssid, bss->bssid, ETH_ALEN) != 0)
2256 continue;
2254#ifdef CONFIG_MAC80211_IBSS_DEBUG 2257#ifdef CONFIG_MAC80211_IBSS_DEBUG
2255 printk(KERN_DEBUG " bssid=%pM found\n", bss->bssid); 2258 printk(KERN_DEBUG " bssid=%pM found\n", bss->bssid);
2256#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 2259#endif /* CONFIG_MAC80211_IBSS_DEBUG */
@@ -2267,7 +2270,9 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2267 "%pM\n", bssid, ifsta->bssid); 2270 "%pM\n", bssid, ifsta->bssid);
2268#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 2271#endif /* CONFIG_MAC80211_IBSS_DEBUG */
2269 2272
2270 if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { 2273 if (found &&
2274 ((!(ifsta->flags & IEEE80211_STA_PREV_BSSID_SET)) ||
2275 memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0)) {
2271 int ret; 2276 int ret;
2272 int search_freq; 2277 int search_freq;
2273 2278
@@ -2605,16 +2610,16 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
2605 memset(ifsta->ssid, 0, sizeof(ifsta->ssid)); 2610 memset(ifsta->ssid, 0, sizeof(ifsta->ssid));
2606 memcpy(ifsta->ssid, ssid, len); 2611 memcpy(ifsta->ssid, ssid, len);
2607 ifsta->ssid_len = len; 2612 ifsta->ssid_len = len;
2608 ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
2609 } 2613 }
2610 2614
2615 ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
2616
2611 if (len) 2617 if (len)
2612 ifsta->flags |= IEEE80211_STA_SSID_SET; 2618 ifsta->flags |= IEEE80211_STA_SSID_SET;
2613 else 2619 else
2614 ifsta->flags &= ~IEEE80211_STA_SSID_SET; 2620 ifsta->flags &= ~IEEE80211_STA_SSID_SET;
2615 2621
2616 if (sdata->vif.type == NL80211_IFTYPE_ADHOC && 2622 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
2617 !(ifsta->flags & IEEE80211_STA_BSSID_SET)) {
2618 ifsta->ibss_join_req = jiffies; 2623 ifsta->ibss_join_req = jiffies;
2619 ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH; 2624 ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH;
2620 return ieee80211_sta_find_ibss(sdata, ifsta); 2625 return ieee80211_sta_find_ibss(sdata, ifsta);
@@ -2634,36 +2639,25 @@ int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
2634int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid) 2639int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
2635{ 2640{
2636 struct ieee80211_if_sta *ifsta; 2641 struct ieee80211_if_sta *ifsta;
2637 int res;
2638 bool valid;
2639 2642
2640 ifsta = &sdata->u.sta; 2643 ifsta = &sdata->u.sta;
2641 valid = is_valid_ether_addr(bssid);
2642 2644
2643 if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { 2645 if (is_valid_ether_addr(bssid)) {
2644 if(valid) 2646 memcpy(ifsta->bssid, bssid, ETH_ALEN);
2645 memcpy(ifsta->bssid, bssid, ETH_ALEN); 2647 ifsta->flags |= IEEE80211_STA_BSSID_SET;
2646 else 2648 } else {
2647 memset(ifsta->bssid, 0, ETH_ALEN); 2649 memset(ifsta->bssid, 0, ETH_ALEN);
2648 res = 0; 2650 ifsta->flags &= ~IEEE80211_STA_BSSID_SET;
2649 /* 2651 }
2650 * Hack! See also ieee80211_sta_set_ssid. 2652
2651 */ 2653 if (netif_running(sdata->dev)) {
2652 if (netif_running(sdata->dev)) 2654 if (ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID)) {
2653 res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID);
2654 if (res) {
2655 printk(KERN_DEBUG "%s: Failed to config new BSSID to " 2655 printk(KERN_DEBUG "%s: Failed to config new BSSID to "
2656 "the low-level driver\n", sdata->dev->name); 2656 "the low-level driver\n", sdata->dev->name);
2657 return res;
2658 } 2657 }
2659 } 2658 }
2660 2659
2661 if (valid) 2660 return ieee80211_sta_set_ssid(sdata, ifsta->ssid, ifsta->ssid_len);
2662 ifsta->flags |= IEEE80211_STA_BSSID_SET;
2663 else
2664 ifsta->flags &= ~IEEE80211_STA_BSSID_SET;
2665
2666 return 0;
2667} 2661}
2668 2662
2669int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len) 2663int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len)