diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-10 05:22:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-10 05:22:26 -0400 |
commit | 65b53e4cc90e59936733b3b95b9451d2ca47528d (patch) | |
tree | 29932718192962671c48c3fd1ea017a6112459e8 /net/mac80211 | |
parent | 788c0a53164c05c5ccdb1472474372b72ba74644 (diff) | |
parent | 2e761e0532a784816e7e822dbaaece8c5d4be14d (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/tg3.c
drivers/net/wireless/rt2x00/rt2x00dev.c
net/mac80211/ieee80211_i.h
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/cfg.c | 4 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 24 | ||||
-rw-r--r-- | net/mac80211/main.c | 3 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 45 | ||||
-rw-r--r-- | net/mac80211/rx.c | 4 | ||||
-rw-r--r-- | net/mac80211/util.c | 4 | ||||
-rw-r--r-- | net/mac80211/wext.c | 26 |
7 files changed, 75 insertions, 35 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index dbf0563c397d..81087281b031 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -674,7 +674,7 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | |||
674 | if (params->vlan) { | 674 | if (params->vlan) { |
675 | sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); | 675 | sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); |
676 | 676 | ||
677 | if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN || | 677 | if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN && |
678 | sdata->vif.type != IEEE80211_IF_TYPE_AP) | 678 | sdata->vif.type != IEEE80211_IF_TYPE_AP) |
679 | return -EINVAL; | 679 | return -EINVAL; |
680 | } else | 680 | } else |
@@ -762,7 +762,7 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
762 | if (params->vlan && params->vlan != sta->sdata->dev) { | 762 | if (params->vlan && params->vlan != sta->sdata->dev) { |
763 | vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); | 763 | vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); |
764 | 764 | ||
765 | if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN || | 765 | if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN && |
766 | vlansdata->vif.type != IEEE80211_IF_TYPE_AP) { | 766 | vlansdata->vif.type != IEEE80211_IF_TYPE_AP) { |
767 | rcu_read_unlock(); | 767 | rcu_read_unlock(); |
768 | return -EINVAL; | 768 | return -EINVAL; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 432011cd3647..884be4d100f1 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -853,7 +853,29 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, | |||
853 | 853 | ||
854 | /* ieee80211_ioctl.c */ | 854 | /* ieee80211_ioctl.c */ |
855 | extern const struct iw_handler_def ieee80211_iw_handler_def; | 855 | extern const struct iw_handler_def ieee80211_iw_handler_def; |
856 | int ieee80211_set_freq(struct ieee80211_local *local, int freq); | 856 | |
857 | /* Least common multiple of the used rates (in 100 kbps). This is used to | ||
858 | * calculate rate_inv values for each rate so that only integers are needed. */ | ||
859 | #define CHAN_UTIL_RATE_LCM 95040 | ||
860 | /* 1 usec is 1/8 * (95040/10) = 1188 */ | ||
861 | #define CHAN_UTIL_PER_USEC 1188 | ||
862 | /* Amount of bits to shift the result right to scale the total utilization | ||
863 | * to values that will not wrap around 32-bit integers. */ | ||
864 | #define CHAN_UTIL_SHIFT 9 | ||
865 | /* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1): | ||
866 | * (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the | ||
867 | * raw value with about 23 should give utilization in 10th of a percentage | ||
868 | * (1/1000). However, utilization is only estimated and not all intervals | ||
869 | * between frames etc. are calculated. 18 seems to give numbers that are closer | ||
870 | * to the real maximum. */ | ||
871 | #define CHAN_UTIL_PER_10MS 18 | ||
872 | #define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC) | ||
873 | #define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC) | ||
874 | |||
875 | |||
876 | /* ieee80211_ioctl.c */ | ||
877 | int ieee80211_set_freq(struct net_device *dev, int freq); | ||
878 | |||
857 | /* ieee80211_sta.c */ | 879 | /* ieee80211_sta.c */ |
858 | void ieee80211_sta_timer(unsigned long data); | 880 | void ieee80211_sta_timer(unsigned long data); |
859 | void ieee80211_sta_work(struct work_struct *work); | 881 | void ieee80211_sta_work(struct work_struct *work); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index f79f6b9938a6..b182f018a187 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -516,6 +516,7 @@ static int ieee80211_stop(struct net_device *dev) | |||
516 | case IEEE80211_IF_TYPE_STA: | 516 | case IEEE80211_IF_TYPE_STA: |
517 | case IEEE80211_IF_TYPE_IBSS: | 517 | case IEEE80211_IF_TYPE_IBSS: |
518 | sdata->u.sta.state = IEEE80211_DISABLED; | 518 | sdata->u.sta.state = IEEE80211_DISABLED; |
519 | memset(sdata->u.sta.bssid, 0, ETH_ALEN); | ||
519 | del_timer_sync(&sdata->u.sta.timer); | 520 | del_timer_sync(&sdata->u.sta.timer); |
520 | /* | 521 | /* |
521 | * When we get here, the interface is marked down. | 522 | * When we get here, the interface is marked down. |
@@ -1314,7 +1315,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
1314 | /* | 1315 | /* |
1315 | * Clear the TX filter mask for this STA when sending the next | 1316 | * Clear the TX filter mask for this STA when sending the next |
1316 | * packet. If the STA went to power save mode, this will happen | 1317 | * packet. If the STA went to power save mode, this will happen |
1317 | * happen when it wakes up for the next time. | 1318 | * when it wakes up for the next time. |
1318 | */ | 1319 | */ |
1319 | set_sta_flags(sta, WLAN_STA_CLEAR_PS_FILT); | 1320 | set_sta_flags(sta, WLAN_STA_CLEAR_PS_FILT); |
1320 | 1321 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index adbc1c804dd3..7f05820dc629 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) | 44 | #define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) |
45 | #define IEEE80211_SCAN_INTERVAL (2 * HZ) | 45 | #define IEEE80211_SCAN_INTERVAL (2 * HZ) |
46 | #define IEEE80211_SCAN_INTERVAL_SLOW (15 * HZ) | 46 | #define IEEE80211_SCAN_INTERVAL_SLOW (15 * HZ) |
47 | #define IEEE80211_IBSS_JOIN_TIMEOUT (20 * HZ) | 47 | #define IEEE80211_IBSS_JOIN_TIMEOUT (7 * HZ) |
48 | 48 | ||
49 | #define IEEE80211_PROBE_DELAY (HZ / 33) | 49 | #define IEEE80211_PROBE_DELAY (HZ / 33) |
50 | #define IEEE80211_CHANNEL_TIME (HZ / 33) | 50 | #define IEEE80211_CHANNEL_TIME (HZ / 33) |
@@ -1337,7 +1337,7 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev, | |||
1337 | 1337 | ||
1338 | /* prepare reordering buffer */ | 1338 | /* prepare reordering buffer */ |
1339 | tid_agg_rx->reorder_buf = | 1339 | tid_agg_rx->reorder_buf = |
1340 | kmalloc(buf_size * sizeof(struct sk_buf *), GFP_ATOMIC); | 1340 | kmalloc(buf_size * sizeof(struct sk_buff *), GFP_ATOMIC); |
1341 | if (!tid_agg_rx->reorder_buf) { | 1341 | if (!tid_agg_rx->reorder_buf) { |
1342 | if (net_ratelimit()) | 1342 | if (net_ratelimit()) |
1343 | printk(KERN_ERR "can not allocate reordering buffer " | 1343 | printk(KERN_ERR "can not allocate reordering buffer " |
@@ -1346,7 +1346,7 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev, | |||
1346 | goto end; | 1346 | goto end; |
1347 | } | 1347 | } |
1348 | memset(tid_agg_rx->reorder_buf, 0, | 1348 | memset(tid_agg_rx->reorder_buf, 0, |
1349 | buf_size * sizeof(struct sk_buf *)); | 1349 | buf_size * sizeof(struct sk_buff *)); |
1350 | 1350 | ||
1351 | if (local->ops->ampdu_action) | 1351 | if (local->ops->ampdu_action) |
1352 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START, | 1352 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START, |
@@ -1625,7 +1625,7 @@ void sta_addba_resp_timer_expired(unsigned long data) | |||
1625 | * only one argument, and both sta_info and TID are needed, so init | 1625 | * only one argument, and both sta_info and TID are needed, so init |
1626 | * flow in sta_info_create gives the TID as data, while the timer_to_id | 1626 | * flow in sta_info_create gives the TID as data, while the timer_to_id |
1627 | * array gives the sta through container_of */ | 1627 | * array gives the sta through container_of */ |
1628 | u16 tid = *(int *)data; | 1628 | u16 tid = *(u8 *)data; |
1629 | struct sta_info *temp_sta = container_of((void *)data, | 1629 | struct sta_info *temp_sta = container_of((void *)data, |
1630 | struct sta_info, timer_to_tid[tid]); | 1630 | struct sta_info, timer_to_tid[tid]); |
1631 | 1631 | ||
@@ -1673,7 +1673,7 @@ timer_expired_exit: | |||
1673 | static void sta_rx_agg_session_timer_expired(unsigned long data) | 1673 | static void sta_rx_agg_session_timer_expired(unsigned long data) |
1674 | { | 1674 | { |
1675 | /* not an elegant detour, but there is no choice as the timer passes | 1675 | /* not an elegant detour, but there is no choice as the timer passes |
1676 | * only one argument, and verious sta_info are needed here, so init | 1676 | * only one argument, and various sta_info are needed here, so init |
1677 | * flow in sta_info_create gives the TID as data, while the timer_to_id | 1677 | * flow in sta_info_create gives the TID as data, while the timer_to_id |
1678 | * array gives the sta through container_of */ | 1678 | * array gives the sta through container_of */ |
1679 | u8 *ptid = (u8 *)data; | 1679 | u8 *ptid = (u8 *)data; |
@@ -2348,6 +2348,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2348 | u8 *pos; | 2348 | u8 *pos; |
2349 | struct ieee80211_sub_if_data *sdata; | 2349 | struct ieee80211_sub_if_data *sdata; |
2350 | struct ieee80211_supported_band *sband; | 2350 | struct ieee80211_supported_band *sband; |
2351 | union iwreq_data wrqu; | ||
2351 | 2352 | ||
2352 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2353 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
2353 | 2354 | ||
@@ -2370,13 +2371,10 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2370 | sdata->drop_unencrypted = bss->capability & | 2371 | sdata->drop_unencrypted = bss->capability & |
2371 | WLAN_CAPABILITY_PRIVACY ? 1 : 0; | 2372 | WLAN_CAPABILITY_PRIVACY ? 1 : 0; |
2372 | 2373 | ||
2373 | res = ieee80211_set_freq(local, bss->freq); | 2374 | res = ieee80211_set_freq(dev, bss->freq); |
2374 | 2375 | ||
2375 | if (local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS) { | 2376 | if (res) |
2376 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | 2377 | return res; |
2377 | "%d MHz\n", dev->name, local->oper_channel->center_freq); | ||
2378 | return -1; | ||
2379 | } | ||
2380 | 2378 | ||
2381 | /* Set beacon template */ | 2379 | /* Set beacon template */ |
2382 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); | 2380 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); |
@@ -2491,7 +2489,9 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2491 | ifsta->state = IEEE80211_IBSS_JOINED; | 2489 | ifsta->state = IEEE80211_IBSS_JOINED; |
2492 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); | 2490 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); |
2493 | 2491 | ||
2494 | ieee80211_rx_bss_put(dev, bss); | 2492 | memset(&wrqu, 0, sizeof(wrqu)); |
2493 | memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN); | ||
2494 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | ||
2495 | 2495 | ||
2496 | return res; | 2496 | return res; |
2497 | } | 2497 | } |
@@ -3518,7 +3518,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
3518 | spin_unlock_bh(&local->sta_bss_lock); | 3518 | spin_unlock_bh(&local->sta_bss_lock); |
3519 | 3519 | ||
3520 | if (selected) { | 3520 | if (selected) { |
3521 | ieee80211_set_freq(local, selected->freq); | 3521 | ieee80211_set_freq(dev, selected->freq); |
3522 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) | 3522 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) |
3523 | ieee80211_sta_set_ssid(dev, selected->ssid, | 3523 | ieee80211_sta_set_ssid(dev, selected->ssid, |
3524 | selected->ssid_len); | 3524 | selected->ssid_len); |
@@ -3553,6 +3553,7 @@ static int ieee80211_sta_create_ibss(struct net_device *dev, | |||
3553 | struct ieee80211_supported_band *sband; | 3553 | struct ieee80211_supported_band *sband; |
3554 | u8 bssid[ETH_ALEN], *pos; | 3554 | u8 bssid[ETH_ALEN], *pos; |
3555 | int i; | 3555 | int i; |
3556 | int ret; | ||
3556 | DECLARE_MAC_BUF(mac); | 3557 | DECLARE_MAC_BUF(mac); |
3557 | 3558 | ||
3558 | #if 0 | 3559 | #if 0 |
@@ -3599,7 +3600,9 @@ static int ieee80211_sta_create_ibss(struct net_device *dev, | |||
3599 | *pos++ = (u8) (rate / 5); | 3600 | *pos++ = (u8) (rate / 5); |
3600 | } | 3601 | } |
3601 | 3602 | ||
3602 | return ieee80211_sta_join_ibss(dev, ifsta, bss); | 3603 | ret = ieee80211_sta_join_ibss(dev, ifsta, bss); |
3604 | ieee80211_rx_bss_put(dev, bss); | ||
3605 | return ret; | ||
3603 | } | 3606 | } |
3604 | 3607 | ||
3605 | 3608 | ||
@@ -3647,10 +3650,13 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
3647 | (bss = ieee80211_rx_bss_get(dev, bssid, | 3650 | (bss = ieee80211_rx_bss_get(dev, bssid, |
3648 | local->hw.conf.channel->center_freq, | 3651 | local->hw.conf.channel->center_freq, |
3649 | ifsta->ssid, ifsta->ssid_len))) { | 3652 | ifsta->ssid, ifsta->ssid_len))) { |
3653 | int ret; | ||
3650 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" | 3654 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" |
3651 | " based on configured SSID\n", | 3655 | " based on configured SSID\n", |
3652 | dev->name, print_mac(mac, bssid)); | 3656 | dev->name, print_mac(mac, bssid)); |
3653 | return ieee80211_sta_join_ibss(dev, ifsta, bss); | 3657 | ret = ieee80211_sta_join_ibss(dev, ifsta, bss); |
3658 | ieee80211_rx_bss_put(dev, bss); | ||
3659 | return ret; | ||
3654 | } | 3660 | } |
3655 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 3661 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3656 | printk(KERN_DEBUG " did not try to join ibss\n"); | 3662 | printk(KERN_DEBUG " did not try to join ibss\n"); |
@@ -4127,18 +4133,17 @@ ieee80211_sta_scan_result(struct net_device *dev, | |||
4127 | 4133 | ||
4128 | memset(&iwe, 0, sizeof(iwe)); | 4134 | memset(&iwe, 0, sizeof(iwe)); |
4129 | iwe.cmd = SIOCGIWFREQ; | 4135 | iwe.cmd = SIOCGIWFREQ; |
4130 | iwe.u.freq.m = bss->freq; | 4136 | iwe.u.freq.m = ieee80211_frequency_to_channel(bss->freq); |
4131 | iwe.u.freq.e = 6; | 4137 | iwe.u.freq.e = 0; |
4132 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 4138 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
4133 | IW_EV_FREQ_LEN); | 4139 | IW_EV_FREQ_LEN); |
4134 | 4140 | ||
4135 | memset(&iwe, 0, sizeof(iwe)); | 4141 | memset(&iwe, 0, sizeof(iwe)); |
4136 | iwe.cmd = SIOCGIWFREQ; | 4142 | iwe.cmd = SIOCGIWFREQ; |
4137 | iwe.u.freq.m = ieee80211_frequency_to_channel(bss->freq); | 4143 | iwe.u.freq.m = bss->freq; |
4138 | iwe.u.freq.e = 0; | 4144 | iwe.u.freq.e = 6; |
4139 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 4145 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
4140 | IW_EV_FREQ_LEN); | 4146 | IW_EV_FREQ_LEN); |
4141 | |||
4142 | memset(&iwe, 0, sizeof(iwe)); | 4147 | memset(&iwe, 0, sizeof(iwe)); |
4143 | iwe.cmd = IWEVQUAL; | 4148 | iwe.cmd = IWEVQUAL; |
4144 | iwe.u.qual.qual = bss->qual; | 4149 | iwe.u.qual.qual = bss->qual; |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 9400a9766a77..a3643fd86af9 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1116,7 +1116,7 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1116 | u16 fc, hdrlen, ethertype; | 1116 | u16 fc, hdrlen, ethertype; |
1117 | u8 *payload; | 1117 | u8 *payload; |
1118 | u8 dst[ETH_ALEN]; | 1118 | u8 dst[ETH_ALEN]; |
1119 | u8 src[ETH_ALEN]; | 1119 | u8 src[ETH_ALEN] __aligned(2); |
1120 | struct sk_buff *skb = rx->skb; | 1120 | struct sk_buff *skb = rx->skb; |
1121 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1121 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1122 | DECLARE_MAC_BUF(mac); | 1122 | DECLARE_MAC_BUF(mac); |
@@ -1259,7 +1259,7 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1259 | */ | 1259 | */ |
1260 | static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx) | 1260 | static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx) |
1261 | { | 1261 | { |
1262 | static const u8 pae_group_addr[ETH_ALEN] | 1262 | static const u8 pae_group_addr[ETH_ALEN] __aligned(2) |
1263 | = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 }; | 1263 | = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 }; |
1264 | struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; | 1264 | struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; |
1265 | 1265 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 5a77e2c01f49..6513bc2d2707 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -34,11 +34,11 @@ void *mac80211_wiphy_privid = &mac80211_wiphy_privid; | |||
34 | 34 | ||
35 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ | 35 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ |
36 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ | 36 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ |
37 | const unsigned char rfc1042_header[] = | 37 | const unsigned char rfc1042_header[] __aligned(2) = |
38 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | 38 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; |
39 | 39 | ||
40 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ | 40 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ |
41 | const unsigned char bridge_tunnel_header[] = | 41 | const unsigned char bridge_tunnel_header[] __aligned(2) = |
42 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; | 42 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; |
43 | 43 | ||
44 | 44 | ||
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index c2e2378af082..4806d96b9877 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -302,14 +302,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
302 | return 0; | 302 | return 0; |
303 | } | 303 | } |
304 | 304 | ||
305 | int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz) | 305 | int ieee80211_set_freq(struct net_device *dev, int freqMHz) |
306 | { | 306 | { |
307 | int ret = -EINVAL; | 307 | int ret = -EINVAL; |
308 | struct ieee80211_channel *chan; | 308 | struct ieee80211_channel *chan; |
309 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
310 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
309 | 311 | ||
310 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | 312 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); |
311 | 313 | ||
312 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | 314 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { |
315 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | ||
316 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | ||
317 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | ||
318 | "%d MHz\n", dev->name, chan->center_freq); | ||
319 | return ret; | ||
320 | } | ||
313 | local->oper_channel = chan; | 321 | local->oper_channel = chan; |
314 | 322 | ||
315 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 323 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
@@ -327,7 +335,6 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
327 | struct iw_request_info *info, | 335 | struct iw_request_info *info, |
328 | struct iw_freq *freq, char *extra) | 336 | struct iw_freq *freq, char *extra) |
329 | { | 337 | { |
330 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
331 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 338 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
332 | 339 | ||
333 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 340 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) |
@@ -341,14 +348,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
341 | IEEE80211_STA_AUTO_CHANNEL_SEL; | 348 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
342 | return 0; | 349 | return 0; |
343 | } else | 350 | } else |
344 | return ieee80211_set_freq(local, | 351 | return ieee80211_set_freq(dev, |
345 | ieee80211_channel_to_frequency(freq->m)); | 352 | ieee80211_channel_to_frequency(freq->m)); |
346 | } else { | 353 | } else { |
347 | int i, div = 1000000; | 354 | int i, div = 1000000; |
348 | for (i = 0; i < freq->e; i++) | 355 | for (i = 0; i < freq->e; i++) |
349 | div /= 10; | 356 | div /= 10; |
350 | if (div > 0) | 357 | if (div > 0) |
351 | return ieee80211_set_freq(local, freq->m / div); | 358 | return ieee80211_set_freq(dev, freq->m / div); |
352 | else | 359 | else |
353 | return -EINVAL; | 360 | return -EINVAL; |
354 | } | 361 | } |
@@ -501,9 +508,14 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
501 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 508 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
502 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 509 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
503 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 510 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
504 | ap_addr->sa_family = ARPHRD_ETHER; | 511 | if (sdata->u.sta.state == IEEE80211_ASSOCIATED) { |
505 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); | 512 | ap_addr->sa_family = ARPHRD_ETHER; |
506 | return 0; | 513 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); |
514 | return 0; | ||
515 | } else { | ||
516 | memset(&ap_addr->sa_data, 0, ETH_ALEN); | ||
517 | return 0; | ||
518 | } | ||
507 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 519 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { |
508 | ap_addr->sa_family = ARPHRD_ETHER; | 520 | ap_addr->sa_family = ARPHRD_ETHER; |
509 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); | 521 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |