diff options
Diffstat (limited to 'net/mac80211/ieee80211_sta.c')
-rw-r--r-- | net/mac80211/ieee80211_sta.c | 72 |
1 files changed, 31 insertions, 41 deletions
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index d2dedcb5a954..9f933aeca719 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
@@ -31,9 +31,7 @@ | |||
31 | #include "ieee80211_i.h" | 31 | #include "ieee80211_i.h" |
32 | #include "ieee80211_rate.h" | 32 | #include "ieee80211_rate.h" |
33 | #include "ieee80211_led.h" | 33 | #include "ieee80211_led.h" |
34 | #ifdef CONFIG_MAC80211_MESH | ||
35 | #include "mesh.h" | 34 | #include "mesh.h" |
36 | #endif | ||
37 | 35 | ||
38 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) | 36 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) |
39 | #define IEEE80211_AUTH_MAX_TRIES 3 | 37 | #define IEEE80211_AUTH_MAX_TRIES 3 |
@@ -1897,12 +1895,13 @@ static void __ieee80211_rx_bss_hash_add(struct net_device *dev, | |||
1897 | { | 1895 | { |
1898 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1896 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1899 | u8 hash_idx; | 1897 | u8 hash_idx; |
1900 | #ifdef CONFIG_MAC80211_MESH | 1898 | |
1901 | if (bss->mesh_cfg) | 1899 | if (bss_mesh_cfg(bss)) |
1902 | hash_idx = mesh_id_hash(bss->mesh_id, bss->mesh_id_len); | 1900 | hash_idx = mesh_id_hash(bss_mesh_id(bss), |
1901 | bss_mesh_id_len(bss)); | ||
1903 | else | 1902 | else |
1904 | #endif | ||
1905 | hash_idx = STA_HASH(bss->bssid); | 1903 | hash_idx = STA_HASH(bss->bssid); |
1904 | |||
1906 | bss->hnext = local->sta_bss_hash[hash_idx]; | 1905 | bss->hnext = local->sta_bss_hash[hash_idx]; |
1907 | local->sta_bss_hash[hash_idx] = bss; | 1906 | local->sta_bss_hash[hash_idx] = bss; |
1908 | } | 1907 | } |
@@ -1967,7 +1966,8 @@ ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int freq, | |||
1967 | spin_lock_bh(&local->sta_bss_lock); | 1966 | spin_lock_bh(&local->sta_bss_lock); |
1968 | bss = local->sta_bss_hash[STA_HASH(bssid)]; | 1967 | bss = local->sta_bss_hash[STA_HASH(bssid)]; |
1969 | while (bss) { | 1968 | while (bss) { |
1970 | if (!bss->mesh_cfg && !memcmp(bss->bssid, bssid, ETH_ALEN) && | 1969 | if (!bss_mesh_cfg(bss) && |
1970 | !memcmp(bss->bssid, bssid, ETH_ALEN) && | ||
1971 | bss->freq == freq && | 1971 | bss->freq == freq && |
1972 | bss->ssid_len == ssid_len && | 1972 | bss->ssid_len == ssid_len && |
1973 | (ssid_len == 0 || !memcmp(bss->ssid, ssid, ssid_len))) { | 1973 | (ssid_len == 0 || !memcmp(bss->ssid, ssid, ssid_len))) { |
@@ -1991,8 +1991,8 @@ ieee80211_rx_mesh_bss_get(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | |||
1991 | spin_lock_bh(&local->sta_bss_lock); | 1991 | spin_lock_bh(&local->sta_bss_lock); |
1992 | bss = local->sta_bss_hash[mesh_id_hash(mesh_id, mesh_id_len)]; | 1992 | bss = local->sta_bss_hash[mesh_id_hash(mesh_id, mesh_id_len)]; |
1993 | while (bss) { | 1993 | while (bss) { |
1994 | if (bss->mesh_cfg && | 1994 | if (bss_mesh_cfg(bss) && |
1995 | !memcmp(bss->mesh_cfg, mesh_cfg, MESH_CFG_CMP_LEN) && | 1995 | !memcmp(bss_mesh_cfg(bss), mesh_cfg, MESH_CFG_CMP_LEN) && |
1996 | bss->freq == freq && | 1996 | bss->freq == freq && |
1997 | mesh_id_len == bss->mesh_id_len && | 1997 | mesh_id_len == bss->mesh_id_len && |
1998 | (mesh_id_len == 0 || !memcmp(bss->mesh_id, mesh_id, | 1998 | (mesh_id_len == 0 || !memcmp(bss->mesh_id, mesh_id, |
@@ -2053,10 +2053,8 @@ static void ieee80211_rx_bss_free(struct ieee80211_sta_bss *bss) | |||
2053 | kfree(bss->rsn_ie); | 2053 | kfree(bss->rsn_ie); |
2054 | kfree(bss->wmm_ie); | 2054 | kfree(bss->wmm_ie); |
2055 | kfree(bss->ht_ie); | 2055 | kfree(bss->ht_ie); |
2056 | #ifdef CONFIG_MAC80211_MESH | 2056 | kfree(bss_mesh_id(bss)); |
2057 | kfree(bss->mesh_id); | 2057 | kfree(bss_mesh_cfg(bss)); |
2058 | kfree(bss->mesh_cfg); | ||
2059 | #endif | ||
2060 | kfree(bss); | 2058 | kfree(bss); |
2061 | } | 2059 | } |
2062 | 2060 | ||
@@ -2322,16 +2320,14 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2322 | beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); | 2320 | beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); |
2323 | ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); | 2321 | ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); |
2324 | 2322 | ||
2325 | #ifdef CONFIG_MAC80211_MESH | 2323 | if (ieee80211_vif_is_mesh(&sdata->vif) && elems.mesh_id && |
2326 | if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT && elems.mesh_id | 2324 | elems.mesh_config && mesh_matches_local(&elems, dev)) { |
2327 | && elems.mesh_config) | 2325 | u64 rates = ieee80211_sta_get_rates(local, &elems, |
2328 | if (mesh_matches_local(&elems, dev)) { | 2326 | rx_status->band); |
2329 | u64 rates = ieee80211_sta_get_rates(local, &elems, | 2327 | |
2330 | rx_status->band); | 2328 | mesh_neighbour_update(mgmt->sa, rates, dev, |
2331 | mesh_neighbour_update(mgmt->sa, rates, dev, | 2329 | mesh_peer_accepts_plinks(&elems, dev)); |
2332 | mesh_peer_accepts_plinks(&elems, dev)); | 2330 | } |
2333 | } | ||
2334 | #endif | ||
2335 | 2331 | ||
2336 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems.supp_rates && | 2332 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems.supp_rates && |
2337 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 && | 2333 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 && |
@@ -2712,9 +2708,7 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev, | |||
2712 | size_t len, | 2708 | size_t len, |
2713 | struct ieee80211_rx_status *rx_status) | 2709 | struct ieee80211_rx_status *rx_status) |
2714 | { | 2710 | { |
2715 | #ifdef CONFIG_MAC80211_MESH | ||
2716 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2711 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2717 | #endif | ||
2718 | 2712 | ||
2719 | if (len < IEEE80211_MIN_ACTION_SIZE) | 2713 | if (len < IEEE80211_MIN_ACTION_SIZE) |
2720 | return; | 2714 | return; |
@@ -2747,17 +2741,14 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev, | |||
2747 | break; | 2741 | break; |
2748 | } | 2742 | } |
2749 | break; | 2743 | break; |
2750 | #ifdef CONFIG_MAC80211_MESH | ||
2751 | case PLINK_CATEGORY: | 2744 | case PLINK_CATEGORY: |
2752 | if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) | 2745 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
2753 | mesh_rx_plink_frame(dev, mgmt, len, rx_status); | 2746 | mesh_rx_plink_frame(dev, mgmt, len, rx_status); |
2754 | break; | 2747 | break; |
2755 | |||
2756 | case MESH_PATH_SEL_CATEGORY: | 2748 | case MESH_PATH_SEL_CATEGORY: |
2757 | if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) | 2749 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
2758 | mesh_rx_path_sel_frame(dev, mgmt, len); | 2750 | mesh_rx_path_sel_frame(dev, mgmt, len); |
2759 | break; | 2751 | break; |
2760 | #endif | ||
2761 | default: | 2752 | default: |
2762 | if (net_ratelimit()) | 2753 | if (net_ratelimit()) |
2763 | printk(KERN_DEBUG "%s: Rx unknown action frame - " | 2754 | printk(KERN_DEBUG "%s: Rx unknown action frame - " |
@@ -3027,8 +3018,9 @@ void ieee80211_sta_work(struct work_struct *work) | |||
3027 | ieee80211_sta_rx_queued_mgmt(dev, skb); | 3018 | ieee80211_sta_rx_queued_mgmt(dev, skb); |
3028 | 3019 | ||
3029 | #ifdef CONFIG_MAC80211_MESH | 3020 | #ifdef CONFIG_MAC80211_MESH |
3030 | if (ifsta->preq_queue_len && time_after(jiffies, ifsta->last_preq + | 3021 | if (ifsta->preq_queue_len && |
3031 | msecs_to_jiffies(ifsta->mshcfg.dot11MeshHWMPpreqMinInterval))) | 3022 | time_after(jiffies, |
3023 | ifsta->last_preq + msecs_to_jiffies(ifsta->mshcfg.dot11MeshHWMPpreqMinInterval))) | ||
3032 | mesh_path_start_discovery(dev); | 3024 | mesh_path_start_discovery(dev); |
3033 | #endif | 3025 | #endif |
3034 | 3026 | ||
@@ -3810,13 +3802,11 @@ ieee80211_sta_scan_result(struct net_device *dev, | |||
3810 | 3802 | ||
3811 | memset(&iwe, 0, sizeof(iwe)); | 3803 | memset(&iwe, 0, sizeof(iwe)); |
3812 | iwe.cmd = SIOCGIWESSID; | 3804 | iwe.cmd = SIOCGIWESSID; |
3813 | if (bss->mesh_cfg) { | 3805 | if (bss_mesh_cfg(bss)) { |
3814 | #ifdef CONFIG_MAC80211_MESH | 3806 | iwe.u.data.length = bss_mesh_id_len(bss); |
3815 | iwe.u.data.length = bss->mesh_id_len; | ||
3816 | iwe.u.data.flags = 1; | 3807 | iwe.u.data.flags = 1; |
3817 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, | 3808 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, |
3818 | bss->mesh_id); | 3809 | bss_mesh_id(bss)); |
3819 | #endif | ||
3820 | } else { | 3810 | } else { |
3821 | iwe.u.data.length = bss->ssid_len; | 3811 | iwe.u.data.length = bss->ssid_len; |
3822 | iwe.u.data.flags = 1; | 3812 | iwe.u.data.flags = 1; |
@@ -3825,10 +3815,10 @@ ieee80211_sta_scan_result(struct net_device *dev, | |||
3825 | } | 3815 | } |
3826 | 3816 | ||
3827 | if (bss->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS | 3817 | if (bss->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS |
3828 | || bss->mesh_cfg)) { | 3818 | || bss_mesh_cfg(bss))) { |
3829 | memset(&iwe, 0, sizeof(iwe)); | 3819 | memset(&iwe, 0, sizeof(iwe)); |
3830 | iwe.cmd = SIOCGIWMODE; | 3820 | iwe.cmd = SIOCGIWMODE; |
3831 | if (bss->mesh_cfg) | 3821 | if (bss_mesh_cfg(bss)) |
3832 | iwe.u.mode = IW_MODE_MESH; | 3822 | iwe.u.mode = IW_MODE_MESH; |
3833 | else if (bss->capability & WLAN_CAPABILITY_ESS) | 3823 | else if (bss->capability & WLAN_CAPABILITY_ESS) |
3834 | iwe.u.mode = IW_MODE_MASTER; | 3824 | iwe.u.mode = IW_MODE_MASTER; |
@@ -3919,9 +3909,9 @@ ieee80211_sta_scan_result(struct net_device *dev, | |||
3919 | } | 3909 | } |
3920 | } | 3910 | } |
3921 | 3911 | ||
3922 | if (bss->mesh_cfg) { | 3912 | if (bss_mesh_cfg(bss)) { |
3923 | char *buf; | 3913 | char *buf; |
3924 | u8 *cfg = bss->mesh_cfg; | 3914 | u8 *cfg = bss_mesh_cfg(bss); |
3925 | buf = kmalloc(200, GFP_ATOMIC); | 3915 | buf = kmalloc(200, GFP_ATOMIC); |
3926 | if (buf) { | 3916 | if (buf) { |
3927 | memset(&iwe, 0, sizeof(iwe)); | 3917 | memset(&iwe, 0, sizeof(iwe)); |