diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 30 | ||||
-rw-r--r-- | net/mac80211/chan.c | 2 | ||||
-rw-r--r-- | net/mac80211/driver-ops.h | 6 | ||||
-rw-r--r-- | net/mac80211/driver-trace.h | 21 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/iface.c | 34 | ||||
-rw-r--r-- | net/mac80211/key.c | 2 | ||||
-rw-r--r-- | net/mac80211/main.c | 18 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 42 | ||||
-rw-r--r-- | net/mac80211/offchannel.c | 7 | ||||
-rw-r--r-- | net/mac80211/rx.c | 4 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 4 | ||||
-rw-r--r-- | net/mac80211/tx.c | 1 | ||||
-rw-r--r-- | net/mac80211/util.c | 22 | ||||
-rw-r--r-- | net/wireless/core.c | 51 | ||||
-rw-r--r-- | net/wireless/core.h | 9 | ||||
-rw-r--r-- | net/wireless/mlme.c | 3 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 58 | ||||
-rw-r--r-- | net/wireless/radiotap.c | 3 | ||||
-rw-r--r-- | net/wireless/reg.c | 6 | ||||
-rw-r--r-- | net/wireless/sme.c | 9 | ||||
-rw-r--r-- | net/wireless/util.c | 15 |
22 files changed, 210 insertions, 139 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 5de1ca3f17b9..c981604b71e6 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -577,6 +577,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
577 | struct sta_info *sta, | 577 | struct sta_info *sta, |
578 | struct station_parameters *params) | 578 | struct station_parameters *params) |
579 | { | 579 | { |
580 | unsigned long flags; | ||
580 | u32 rates; | 581 | u32 rates; |
581 | int i, j; | 582 | int i, j; |
582 | struct ieee80211_supported_band *sband; | 583 | struct ieee80211_supported_band *sband; |
@@ -585,7 +586,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
585 | 586 | ||
586 | sband = local->hw.wiphy->bands[local->oper_channel->band]; | 587 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
587 | 588 | ||
588 | spin_lock_bh(&sta->lock); | 589 | spin_lock_irqsave(&sta->flaglock, flags); |
589 | mask = params->sta_flags_mask; | 590 | mask = params->sta_flags_mask; |
590 | set = params->sta_flags_set; | 591 | set = params->sta_flags_set; |
591 | 592 | ||
@@ -612,7 +613,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
612 | if (set & BIT(NL80211_STA_FLAG_MFP)) | 613 | if (set & BIT(NL80211_STA_FLAG_MFP)) |
613 | sta->flags |= WLAN_STA_MFP; | 614 | sta->flags |= WLAN_STA_MFP; |
614 | } | 615 | } |
615 | spin_unlock_bh(&sta->lock); | 616 | spin_unlock_irqrestore(&sta->flaglock, flags); |
616 | 617 | ||
617 | /* | 618 | /* |
618 | * cfg80211 validates this (1-2007) and allows setting the AID | 619 | * cfg80211 validates this (1-2007) and allows setting the AID |
@@ -1150,15 +1151,26 @@ static int ieee80211_scan(struct wiphy *wiphy, | |||
1150 | struct net_device *dev, | 1151 | struct net_device *dev, |
1151 | struct cfg80211_scan_request *req) | 1152 | struct cfg80211_scan_request *req) |
1152 | { | 1153 | { |
1153 | struct ieee80211_sub_if_data *sdata; | 1154 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1154 | |||
1155 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1156 | 1155 | ||
1157 | if (sdata->vif.type != NL80211_IFTYPE_STATION && | 1156 | switch (ieee80211_vif_type_p2p(&sdata->vif)) { |
1158 | sdata->vif.type != NL80211_IFTYPE_ADHOC && | 1157 | case NL80211_IFTYPE_STATION: |
1159 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && | 1158 | case NL80211_IFTYPE_ADHOC: |
1160 | (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon)) | 1159 | case NL80211_IFTYPE_MESH_POINT: |
1160 | case NL80211_IFTYPE_P2P_CLIENT: | ||
1161 | break; | ||
1162 | case NL80211_IFTYPE_P2P_GO: | ||
1163 | if (sdata->local->ops->hw_scan) | ||
1164 | break; | ||
1165 | /* FIXME: implement NoA while scanning in software */ | ||
1166 | return -EOPNOTSUPP; | ||
1167 | case NL80211_IFTYPE_AP: | ||
1168 | if (sdata->u.ap.beacon) | ||
1169 | return -EOPNOTSUPP; | ||
1170 | break; | ||
1171 | default: | ||
1161 | return -EOPNOTSUPP; | 1172 | return -EOPNOTSUPP; |
1173 | } | ||
1162 | 1174 | ||
1163 | return ieee80211_request_scan(sdata, req); | 1175 | return ieee80211_request_scan(sdata, req); |
1164 | } | 1176 | } |
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 32be11e4c4d9..5b24740fc0b0 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -11,7 +11,7 @@ __ieee80211_get_channel_mode(struct ieee80211_local *local, | |||
11 | { | 11 | { |
12 | struct ieee80211_sub_if_data *sdata; | 12 | struct ieee80211_sub_if_data *sdata; |
13 | 13 | ||
14 | WARN_ON(!mutex_is_locked(&local->iflist_mtx)); | 14 | lockdep_assert_held(&local->iflist_mtx); |
15 | 15 | ||
16 | list_for_each_entry(sdata, &local->interfaces, list) { | 16 | list_for_each_entry(sdata, &local->interfaces, list) { |
17 | if (sdata == ignore) | 17 | if (sdata == ignore) |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 6064b7b09e01..16983825f8e8 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -56,14 +56,14 @@ static inline int drv_add_interface(struct ieee80211_local *local, | |||
56 | 56 | ||
57 | static inline int drv_change_interface(struct ieee80211_local *local, | 57 | static inline int drv_change_interface(struct ieee80211_local *local, |
58 | struct ieee80211_sub_if_data *sdata, | 58 | struct ieee80211_sub_if_data *sdata, |
59 | enum nl80211_iftype type) | 59 | enum nl80211_iftype type, bool p2p) |
60 | { | 60 | { |
61 | int ret; | 61 | int ret; |
62 | 62 | ||
63 | might_sleep(); | 63 | might_sleep(); |
64 | 64 | ||
65 | trace_drv_change_interface(local, sdata, type); | 65 | trace_drv_change_interface(local, sdata, type, p2p); |
66 | ret = local->ops->change_interface(&local->hw, &sdata->vif, type); | 66 | ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); |
67 | trace_drv_return_int(local, ret); | 67 | trace_drv_return_int(local, ret); |
68 | return ret; | 68 | return ret; |
69 | } | 69 | } |
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index f6f3d89e43fa..6831fb1641c8 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -25,12 +25,14 @@ static inline void trace_ ## name(proto) {} | |||
25 | #define STA_PR_FMT " sta:%pM" | 25 | #define STA_PR_FMT " sta:%pM" |
26 | #define STA_PR_ARG __entry->sta_addr | 26 | #define STA_PR_ARG __entry->sta_addr |
27 | 27 | ||
28 | #define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \ | 28 | #define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \ |
29 | __field(bool, p2p) \ | ||
29 | __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") | 30 | __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") |
30 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ | 31 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ |
32 | __entry->p2p = sdata->vif.p2p; \ | ||
31 | __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") | 33 | __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") |
32 | #define VIF_PR_FMT " vif:%s(%d)" | 34 | #define VIF_PR_FMT " vif:%s(%d%s)" |
33 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type | 35 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" |
34 | 36 | ||
35 | /* | 37 | /* |
36 | * Tracing for driver callbacks. | 38 | * Tracing for driver callbacks. |
@@ -139,25 +141,28 @@ TRACE_EVENT(drv_add_interface, | |||
139 | TRACE_EVENT(drv_change_interface, | 141 | TRACE_EVENT(drv_change_interface, |
140 | TP_PROTO(struct ieee80211_local *local, | 142 | TP_PROTO(struct ieee80211_local *local, |
141 | struct ieee80211_sub_if_data *sdata, | 143 | struct ieee80211_sub_if_data *sdata, |
142 | enum nl80211_iftype type), | 144 | enum nl80211_iftype type, bool p2p), |
143 | 145 | ||
144 | TP_ARGS(local, sdata, type), | 146 | TP_ARGS(local, sdata, type, p2p), |
145 | 147 | ||
146 | TP_STRUCT__entry( | 148 | TP_STRUCT__entry( |
147 | LOCAL_ENTRY | 149 | LOCAL_ENTRY |
148 | VIF_ENTRY | 150 | VIF_ENTRY |
149 | __field(u32, new_type) | 151 | __field(u32, new_type) |
152 | __field(bool, new_p2p) | ||
150 | ), | 153 | ), |
151 | 154 | ||
152 | TP_fast_assign( | 155 | TP_fast_assign( |
153 | LOCAL_ASSIGN; | 156 | LOCAL_ASSIGN; |
154 | VIF_ASSIGN; | 157 | VIF_ASSIGN; |
155 | __entry->new_type = type; | 158 | __entry->new_type = type; |
159 | __entry->new_p2p = p2p; | ||
156 | ), | 160 | ), |
157 | 161 | ||
158 | TP_printk( | 162 | TP_printk( |
159 | LOCAL_PR_FMT VIF_PR_FMT " new type:%d", | 163 | LOCAL_PR_FMT VIF_PR_FMT " new type:%d%s", |
160 | LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type | 164 | LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type, |
165 | __entry->new_p2p ? "/p2p" : "" | ||
161 | ) | 166 | ) |
162 | ); | 167 | ); |
163 | 168 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4e635e2fabdb..9346a6b0f400 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1041,6 +1041,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); | |||
1041 | void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); | 1041 | void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); |
1042 | void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | 1042 | void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, |
1043 | struct sk_buff *skb); | 1043 | struct sk_buff *skb); |
1044 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); | ||
1045 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); | ||
1044 | 1046 | ||
1045 | /* IBSS code */ | 1047 | /* IBSS code */ |
1046 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); | 1048 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index c1cc200ac81f..66785739dad3 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -188,6 +188,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
188 | break; | 188 | break; |
189 | case NL80211_IFTYPE_UNSPECIFIED: | 189 | case NL80211_IFTYPE_UNSPECIFIED: |
190 | case NUM_NL80211_IFTYPES: | 190 | case NUM_NL80211_IFTYPES: |
191 | case NL80211_IFTYPE_P2P_CLIENT: | ||
192 | case NL80211_IFTYPE_P2P_GO: | ||
191 | /* cannot happen */ | 193 | /* cannot happen */ |
192 | WARN_ON(1); | 194 | WARN_ON(1); |
193 | break; | 195 | break; |
@@ -280,6 +282,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
280 | netif_carrier_on(dev); | 282 | netif_carrier_on(dev); |
281 | } | 283 | } |
282 | 284 | ||
285 | set_bit(SDATA_STATE_RUNNING, &sdata->state); | ||
286 | |||
283 | if (sdata->vif.type == NL80211_IFTYPE_WDS) { | 287 | if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
284 | /* Create STA entry for the WDS peer */ | 288 | /* Create STA entry for the WDS peer */ |
285 | sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, | 289 | sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, |
@@ -331,8 +335,6 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
331 | 335 | ||
332 | netif_tx_start_all_queues(dev); | 336 | netif_tx_start_all_queues(dev); |
333 | 337 | ||
334 | set_bit(SDATA_STATE_RUNNING, &sdata->state); | ||
335 | |||
336 | return 0; | 338 | return 0; |
337 | err_del_interface: | 339 | err_del_interface: |
338 | drv_remove_interface(local, &sdata->vif); | 340 | drv_remove_interface(local, &sdata->vif); |
@@ -343,6 +345,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
343 | sdata->bss = NULL; | 345 | sdata->bss = NULL; |
344 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 346 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
345 | list_del(&sdata->u.vlan.list); | 347 | list_del(&sdata->u.vlan.list); |
348 | clear_bit(SDATA_STATE_RUNNING, &sdata->state); | ||
346 | return res; | 349 | return res; |
347 | } | 350 | } |
348 | 351 | ||
@@ -843,6 +846,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
843 | 846 | ||
844 | /* and set some type-dependent values */ | 847 | /* and set some type-dependent values */ |
845 | sdata->vif.type = type; | 848 | sdata->vif.type = type; |
849 | sdata->vif.p2p = false; | ||
846 | sdata->dev->netdev_ops = &ieee80211_dataif_ops; | 850 | sdata->dev->netdev_ops = &ieee80211_dataif_ops; |
847 | sdata->wdev.iftype = type; | 851 | sdata->wdev.iftype = type; |
848 | 852 | ||
@@ -856,10 +860,20 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
856 | INIT_WORK(&sdata->work, ieee80211_iface_work); | 860 | INIT_WORK(&sdata->work, ieee80211_iface_work); |
857 | 861 | ||
858 | switch (type) { | 862 | switch (type) { |
863 | case NL80211_IFTYPE_P2P_GO: | ||
864 | type = NL80211_IFTYPE_AP; | ||
865 | sdata->vif.type = type; | ||
866 | sdata->vif.p2p = true; | ||
867 | /* fall through */ | ||
859 | case NL80211_IFTYPE_AP: | 868 | case NL80211_IFTYPE_AP: |
860 | skb_queue_head_init(&sdata->u.ap.ps_bc_buf); | 869 | skb_queue_head_init(&sdata->u.ap.ps_bc_buf); |
861 | INIT_LIST_HEAD(&sdata->u.ap.vlans); | 870 | INIT_LIST_HEAD(&sdata->u.ap.vlans); |
862 | break; | 871 | break; |
872 | case NL80211_IFTYPE_P2P_CLIENT: | ||
873 | type = NL80211_IFTYPE_STATION; | ||
874 | sdata->vif.type = type; | ||
875 | sdata->vif.p2p = true; | ||
876 | /* fall through */ | ||
863 | case NL80211_IFTYPE_STATION: | 877 | case NL80211_IFTYPE_STATION: |
864 | ieee80211_sta_setup_sdata(sdata); | 878 | ieee80211_sta_setup_sdata(sdata); |
865 | break; | 879 | break; |
@@ -893,6 +907,8 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | |||
893 | { | 907 | { |
894 | struct ieee80211_local *local = sdata->local; | 908 | struct ieee80211_local *local = sdata->local; |
895 | int ret, err; | 909 | int ret, err; |
910 | enum nl80211_iftype internal_type = type; | ||
911 | bool p2p = false; | ||
896 | 912 | ||
897 | ASSERT_RTNL(); | 913 | ASSERT_RTNL(); |
898 | 914 | ||
@@ -925,11 +941,19 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | |||
925 | * code isn't prepared to handle). | 941 | * code isn't prepared to handle). |
926 | */ | 942 | */ |
927 | break; | 943 | break; |
944 | case NL80211_IFTYPE_P2P_CLIENT: | ||
945 | p2p = true; | ||
946 | internal_type = NL80211_IFTYPE_STATION; | ||
947 | break; | ||
948 | case NL80211_IFTYPE_P2P_GO: | ||
949 | p2p = true; | ||
950 | internal_type = NL80211_IFTYPE_AP; | ||
951 | break; | ||
928 | default: | 952 | default: |
929 | return -EBUSY; | 953 | return -EBUSY; |
930 | } | 954 | } |
931 | 955 | ||
932 | ret = ieee80211_check_concurrent_iface(sdata, type); | 956 | ret = ieee80211_check_concurrent_iface(sdata, internal_type); |
933 | if (ret) | 957 | if (ret) |
934 | return ret; | 958 | return ret; |
935 | 959 | ||
@@ -937,7 +961,7 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | |||
937 | 961 | ||
938 | ieee80211_teardown_sdata(sdata->dev); | 962 | ieee80211_teardown_sdata(sdata->dev); |
939 | 963 | ||
940 | ret = drv_change_interface(local, sdata, type); | 964 | ret = drv_change_interface(local, sdata, internal_type, p2p); |
941 | if (ret) | 965 | if (ret) |
942 | type = sdata->vif.type; | 966 | type = sdata->vif.type; |
943 | 967 | ||
@@ -956,7 +980,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
956 | 980 | ||
957 | ASSERT_RTNL(); | 981 | ASSERT_RTNL(); |
958 | 982 | ||
959 | if (type == sdata->vif.type) | 983 | if (type == ieee80211_vif_type_p2p(&sdata->vif)) |
960 | return 0; | 984 | return 0; |
961 | 985 | ||
962 | /* Setting ad-hoc mode on non-IBSS channel is not supported. */ | 986 | /* Setting ad-hoc mode on non-IBSS channel is not supported. */ |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 3570f8c2bb40..6a63d1abd14d 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -49,7 +49,7 @@ static const u8 bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | |||
49 | 49 | ||
50 | static void assert_key_lock(struct ieee80211_local *local) | 50 | static void assert_key_lock(struct ieee80211_local *local) |
51 | { | 51 | { |
52 | WARN_ON(!mutex_is_locked(&local->key_mtx)); | 52 | lockdep_assert_held(&local->key_mtx); |
53 | } | 53 | } |
54 | 54 | ||
55 | static struct ieee80211_sta *get_sta_for_key(struct ieee80211_key *key) | 55 | static struct ieee80211_sta *get_sta_for_key(struct ieee80211_key *key) |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index b8cf2821f00d..fda97bb0018b 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -305,6 +305,9 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw) | |||
305 | 305 | ||
306 | trace_api_restart_hw(local); | 306 | trace_api_restart_hw(local); |
307 | 307 | ||
308 | /* wait for scan work complete */ | ||
309 | flush_workqueue(local->workqueue); | ||
310 | |||
308 | WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), | 311 | WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), |
309 | "%s called with hardware scan in progress\n", __func__); | 312 | "%s called with hardware scan in progress\n", __func__); |
310 | 313 | ||
@@ -456,6 +459,21 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { | |||
456 | BIT(IEEE80211_STYPE_DEAUTH >> 4) | | 459 | BIT(IEEE80211_STYPE_DEAUTH >> 4) | |
457 | BIT(IEEE80211_STYPE_ACTION >> 4), | 460 | BIT(IEEE80211_STYPE_ACTION >> 4), |
458 | }, | 461 | }, |
462 | [NL80211_IFTYPE_P2P_CLIENT] = { | ||
463 | .tx = 0xffff, | ||
464 | .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | | ||
465 | BIT(IEEE80211_STYPE_PROBE_REQ >> 4), | ||
466 | }, | ||
467 | [NL80211_IFTYPE_P2P_GO] = { | ||
468 | .tx = 0xffff, | ||
469 | .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | | ||
470 | BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | | ||
471 | BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | | ||
472 | BIT(IEEE80211_STYPE_DISASSOC >> 4) | | ||
473 | BIT(IEEE80211_STYPE_AUTH >> 4) | | ||
474 | BIT(IEEE80211_STYPE_DEAUTH >> 4) | | ||
475 | BIT(IEEE80211_STYPE_ACTION >> 4), | ||
476 | }, | ||
459 | }; | 477 | }; |
460 | 478 | ||
461 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | 479 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 0cb822cc12e9..8b733cf6f3ea 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -92,7 +92,7 @@ enum rx_mgmt_action { | |||
92 | /* utils */ | 92 | /* utils */ |
93 | static inline void ASSERT_MGD_MTX(struct ieee80211_if_managed *ifmgd) | 93 | static inline void ASSERT_MGD_MTX(struct ieee80211_if_managed *ifmgd) |
94 | { | 94 | { |
95 | WARN_ON(!mutex_is_locked(&ifmgd->mtx)); | 95 | lockdep_assert_held(&ifmgd->mtx); |
96 | } | 96 | } |
97 | 97 | ||
98 | /* | 98 | /* |
@@ -115,7 +115,7 @@ static void run_again(struct ieee80211_if_managed *ifmgd, | |||
115 | mod_timer(&ifmgd->timer, timeout); | 115 | mod_timer(&ifmgd->timer, timeout); |
116 | } | 116 | } |
117 | 117 | ||
118 | static void mod_beacon_timer(struct ieee80211_sub_if_data *sdata) | 118 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata) |
119 | { | 119 | { |
120 | if (sdata->local->hw.flags & IEEE80211_HW_BEACON_FILTER) | 120 | if (sdata->local->hw.flags & IEEE80211_HW_BEACON_FILTER) |
121 | return; | 121 | return; |
@@ -124,6 +124,19 @@ static void mod_beacon_timer(struct ieee80211_sub_if_data *sdata) | |||
124 | round_jiffies_up(jiffies + IEEE80211_BEACON_LOSS_TIME)); | 124 | round_jiffies_up(jiffies + IEEE80211_BEACON_LOSS_TIME)); |
125 | } | 125 | } |
126 | 126 | ||
127 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata) | ||
128 | { | ||
129 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
130 | |||
131 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) | ||
132 | return; | ||
133 | |||
134 | mod_timer(&sdata->u.mgd.conn_mon_timer, | ||
135 | round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); | ||
136 | |||
137 | ifmgd->probe_send_count = 0; | ||
138 | } | ||
139 | |||
127 | static int ecw2cw(int ecw) | 140 | static int ecw2cw(int ecw) |
128 | { | 141 | { |
129 | return (1 << ecw) - 1; | 142 | return (1 << ecw) - 1; |
@@ -1018,21 +1031,26 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | |||
1018 | if (is_multicast_ether_addr(hdr->addr1)) | 1031 | if (is_multicast_ether_addr(hdr->addr1)) |
1019 | return; | 1032 | return; |
1020 | 1033 | ||
1021 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) | 1034 | ieee80211_sta_reset_conn_monitor(sdata); |
1022 | return; | ||
1023 | |||
1024 | mod_timer(&sdata->u.mgd.conn_mon_timer, | ||
1025 | round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); | ||
1026 | } | 1035 | } |
1027 | 1036 | ||
1028 | static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) | 1037 | static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) |
1029 | { | 1038 | { |
1030 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 1039 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
1031 | const u8 *ssid; | 1040 | const u8 *ssid; |
1041 | u8 *dst = ifmgd->associated->bssid; | ||
1042 | u8 unicast_limit = max(1, IEEE80211_MAX_PROBE_TRIES - 3); | ||
1043 | |||
1044 | /* | ||
1045 | * Try sending broadcast probe requests for the last three | ||
1046 | * probe requests after the first ones failed since some | ||
1047 | * buggy APs only support broadcast probe requests. | ||
1048 | */ | ||
1049 | if (ifmgd->probe_send_count >= unicast_limit) | ||
1050 | dst = NULL; | ||
1032 | 1051 | ||
1033 | ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); | 1052 | ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); |
1034 | ieee80211_send_probe_req(sdata, ifmgd->associated->bssid, | 1053 | ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0); |
1035 | ssid + 2, ssid[1], NULL, 0); | ||
1036 | 1054 | ||
1037 | ifmgd->probe_send_count++; | 1055 | ifmgd->probe_send_count++; |
1038 | ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT; | 1056 | ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT; |
@@ -1381,7 +1399,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1381 | * Also start the timer that will detect beacon loss. | 1399 | * Also start the timer that will detect beacon loss. |
1382 | */ | 1400 | */ |
1383 | ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt); | 1401 | ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt); |
1384 | mod_beacon_timer(sdata); | 1402 | ieee80211_sta_reset_beacon_monitor(sdata); |
1385 | 1403 | ||
1386 | return true; | 1404 | return true; |
1387 | } | 1405 | } |
@@ -1484,7 +1502,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
1484 | * we have or will be receiving any beacons or data, so let's | 1502 | * we have or will be receiving any beacons or data, so let's |
1485 | * schedule the timers again, just in case. | 1503 | * schedule the timers again, just in case. |
1486 | */ | 1504 | */ |
1487 | mod_beacon_timer(sdata); | 1505 | ieee80211_sta_reset_beacon_monitor(sdata); |
1488 | 1506 | ||
1489 | mod_timer(&ifmgd->conn_mon_timer, | 1507 | mod_timer(&ifmgd->conn_mon_timer, |
1490 | round_jiffies_up(jiffies + | 1508 | round_jiffies_up(jiffies + |
@@ -1610,7 +1628,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1610 | * Push the beacon loss detection into the future since | 1628 | * Push the beacon loss detection into the future since |
1611 | * we are processing a beacon from the AP just now. | 1629 | * we are processing a beacon from the AP just now. |
1612 | */ | 1630 | */ |
1613 | mod_beacon_timer(sdata); | 1631 | ieee80211_sta_reset_beacon_monitor(sdata); |
1614 | 1632 | ||
1615 | ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); | 1633 | ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); |
1616 | ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable, | 1634 | ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable, |
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index eeacaa59380a..4b564091e51d 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -22,12 +22,16 @@ | |||
22 | static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata) | 22 | static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata) |
23 | { | 23 | { |
24 | struct ieee80211_local *local = sdata->local; | 24 | struct ieee80211_local *local = sdata->local; |
25 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
25 | 26 | ||
26 | local->offchannel_ps_enabled = false; | 27 | local->offchannel_ps_enabled = false; |
27 | 28 | ||
28 | /* FIXME: what to do when local->pspolling is true? */ | 29 | /* FIXME: what to do when local->pspolling is true? */ |
29 | 30 | ||
30 | del_timer_sync(&local->dynamic_ps_timer); | 31 | del_timer_sync(&local->dynamic_ps_timer); |
32 | del_timer_sync(&ifmgd->bcn_mon_timer); | ||
33 | del_timer_sync(&ifmgd->conn_mon_timer); | ||
34 | |||
31 | cancel_work_sync(&local->dynamic_ps_enable_work); | 35 | cancel_work_sync(&local->dynamic_ps_enable_work); |
32 | 36 | ||
33 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { | 37 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { |
@@ -85,6 +89,9 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata) | |||
85 | mod_timer(&local->dynamic_ps_timer, jiffies + | 89 | mod_timer(&local->dynamic_ps_timer, jiffies + |
86 | msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); | 90 | msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); |
87 | } | 91 | } |
92 | |||
93 | ieee80211_sta_reset_beacon_monitor(sdata); | ||
94 | ieee80211_sta_reset_conn_monitor(sdata); | ||
88 | } | 95 | } |
89 | 96 | ||
90 | void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local) | 97 | void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local) |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index ac205a33690f..c0368152b721 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2588,9 +2588,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2588 | if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) | 2588 | if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) |
2589 | return 0; | 2589 | return 0; |
2590 | break; | 2590 | break; |
2591 | case NL80211_IFTYPE_MONITOR: | 2591 | default: |
2592 | case NL80211_IFTYPE_UNSPECIFIED: | ||
2593 | case NUM_NL80211_IFTYPES: | ||
2594 | /* should never get here */ | 2592 | /* should never get here */ |
2595 | WARN_ON(1); | 2593 | WARN_ON(1); |
2596 | break; | 2594 | break; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 687077e49dc6..44e10a9de0a7 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -125,7 +125,7 @@ struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, | |||
125 | lockdep_is_held(&local->sta_mtx)); | 125 | lockdep_is_held(&local->sta_mtx)); |
126 | while (sta) { | 126 | while (sta) { |
127 | if ((sta->sdata == sdata || | 127 | if ((sta->sdata == sdata || |
128 | sta->sdata->bss == sdata->bss) && | 128 | (sta->sdata->bss && sta->sdata->bss == sdata->bss)) && |
129 | memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) | 129 | memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) |
130 | break; | 130 | break; |
131 | sta = rcu_dereference_check(sta->hnext, | 131 | sta = rcu_dereference_check(sta->hnext, |
@@ -280,7 +280,7 @@ static int sta_info_finish_insert(struct sta_info *sta, bool async) | |||
280 | unsigned long flags; | 280 | unsigned long flags; |
281 | int err = 0; | 281 | int err = 0; |
282 | 282 | ||
283 | WARN_ON(!mutex_is_locked(&local->sta_mtx)); | 283 | lockdep_assert_held(&local->sta_mtx); |
284 | 284 | ||
285 | /* notify driver */ | 285 | /* notify driver */ |
286 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 286 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index ccf373788ce9..e1733dcb58a7 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1609,6 +1609,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, | |||
1609 | return; | 1609 | return; |
1610 | } | 1610 | } |
1611 | 1611 | ||
1612 | hdr = (struct ieee80211_hdr *) skb->data; | ||
1612 | info->control.vif = &sdata->vif; | 1613 | info->control.vif = &sdata->vif; |
1613 | 1614 | ||
1614 | if (ieee80211_vif_is_mesh(&sdata->vif) && | 1615 | if (ieee80211_vif_is_mesh(&sdata->vif) && |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index bd40b11d5ab9..737f4267c335 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -474,16 +474,10 @@ void ieee80211_iterate_active_interfaces( | |||
474 | 474 | ||
475 | list_for_each_entry(sdata, &local->interfaces, list) { | 475 | list_for_each_entry(sdata, &local->interfaces, list) { |
476 | switch (sdata->vif.type) { | 476 | switch (sdata->vif.type) { |
477 | case NUM_NL80211_IFTYPES: | ||
478 | case NL80211_IFTYPE_UNSPECIFIED: | ||
479 | case NL80211_IFTYPE_MONITOR: | 477 | case NL80211_IFTYPE_MONITOR: |
480 | case NL80211_IFTYPE_AP_VLAN: | 478 | case NL80211_IFTYPE_AP_VLAN: |
481 | continue; | 479 | continue; |
482 | case NL80211_IFTYPE_AP: | 480 | default: |
483 | case NL80211_IFTYPE_STATION: | ||
484 | case NL80211_IFTYPE_ADHOC: | ||
485 | case NL80211_IFTYPE_WDS: | ||
486 | case NL80211_IFTYPE_MESH_POINT: | ||
487 | break; | 481 | break; |
488 | } | 482 | } |
489 | if (ieee80211_sdata_running(sdata)) | 483 | if (ieee80211_sdata_running(sdata)) |
@@ -508,16 +502,10 @@ void ieee80211_iterate_active_interfaces_atomic( | |||
508 | 502 | ||
509 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 503 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
510 | switch (sdata->vif.type) { | 504 | switch (sdata->vif.type) { |
511 | case NUM_NL80211_IFTYPES: | ||
512 | case NL80211_IFTYPE_UNSPECIFIED: | ||
513 | case NL80211_IFTYPE_MONITOR: | 505 | case NL80211_IFTYPE_MONITOR: |
514 | case NL80211_IFTYPE_AP_VLAN: | 506 | case NL80211_IFTYPE_AP_VLAN: |
515 | continue; | 507 | continue; |
516 | case NL80211_IFTYPE_AP: | 508 | default: |
517 | case NL80211_IFTYPE_STATION: | ||
518 | case NL80211_IFTYPE_ADHOC: | ||
519 | case NL80211_IFTYPE_WDS: | ||
520 | case NL80211_IFTYPE_MESH_POINT: | ||
521 | break; | 509 | break; |
522 | } | 510 | } |
523 | if (ieee80211_sdata_running(sdata)) | 511 | if (ieee80211_sdata_running(sdata)) |
@@ -1193,6 +1181,8 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1193 | break; | 1181 | break; |
1194 | case NL80211_IFTYPE_UNSPECIFIED: | 1182 | case NL80211_IFTYPE_UNSPECIFIED: |
1195 | case NUM_NL80211_IFTYPES: | 1183 | case NUM_NL80211_IFTYPES: |
1184 | case NL80211_IFTYPE_P2P_CLIENT: | ||
1185 | case NL80211_IFTYPE_P2P_GO: | ||
1196 | WARN_ON(1); | 1186 | WARN_ON(1); |
1197 | break; | 1187 | break; |
1198 | } | 1188 | } |
@@ -1296,9 +1286,9 @@ void ieee80211_recalc_smps(struct ieee80211_local *local, | |||
1296 | int count = 0; | 1286 | int count = 0; |
1297 | 1287 | ||
1298 | if (forsdata) | 1288 | if (forsdata) |
1299 | WARN_ON(!mutex_is_locked(&forsdata->u.mgd.mtx)); | 1289 | lockdep_assert_held(&forsdata->u.mgd.mtx); |
1300 | 1290 | ||
1301 | WARN_ON(!mutex_is_locked(&local->iflist_mtx)); | 1291 | lockdep_assert_held(&local->iflist_mtx); |
1302 | 1292 | ||
1303 | /* | 1293 | /* |
1304 | * This function could be improved to handle multiple | 1294 | * This function could be improved to handle multiple |
diff --git a/net/wireless/core.c b/net/wireless/core.c index d587ad284b3d..9c21ebf9780e 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -729,6 +729,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb, | |||
729 | dev->ethtool_ops = &cfg80211_ethtool_ops; | 729 | dev->ethtool_ops = &cfg80211_ethtool_ops; |
730 | 730 | ||
731 | if ((wdev->iftype == NL80211_IFTYPE_STATION || | 731 | if ((wdev->iftype == NL80211_IFTYPE_STATION || |
732 | wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || | ||
732 | wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) | 733 | wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) |
733 | dev->priv_flags |= IFF_DONT_BRIDGE; | 734 | dev->priv_flags |= IFF_DONT_BRIDGE; |
734 | break; | 735 | break; |
@@ -737,6 +738,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb, | |||
737 | case NL80211_IFTYPE_ADHOC: | 738 | case NL80211_IFTYPE_ADHOC: |
738 | cfg80211_leave_ibss(rdev, dev, true); | 739 | cfg80211_leave_ibss(rdev, dev, true); |
739 | break; | 740 | break; |
741 | case NL80211_IFTYPE_P2P_CLIENT: | ||
740 | case NL80211_IFTYPE_STATION: | 742 | case NL80211_IFTYPE_STATION: |
741 | wdev_lock(wdev); | 743 | wdev_lock(wdev); |
742 | #ifdef CONFIG_CFG80211_WEXT | 744 | #ifdef CONFIG_CFG80211_WEXT |
@@ -915,52 +917,3 @@ static void __exit cfg80211_exit(void) | |||
915 | destroy_workqueue(cfg80211_wq); | 917 | destroy_workqueue(cfg80211_wq); |
916 | } | 918 | } |
917 | module_exit(cfg80211_exit); | 919 | module_exit(cfg80211_exit); |
918 | |||
919 | static int ___wiphy_printk(const char *level, const struct wiphy *wiphy, | ||
920 | struct va_format *vaf) | ||
921 | { | ||
922 | if (!wiphy) | ||
923 | return printk("%s(NULL wiphy *): %pV", level, vaf); | ||
924 | |||
925 | return printk("%s%s: %pV", level, wiphy_name(wiphy), vaf); | ||
926 | } | ||
927 | |||
928 | int __wiphy_printk(const char *level, const struct wiphy *wiphy, | ||
929 | const char *fmt, ...) | ||
930 | { | ||
931 | struct va_format vaf; | ||
932 | va_list args; | ||
933 | int r; | ||
934 | |||
935 | va_start(args, fmt); | ||
936 | |||
937 | vaf.fmt = fmt; | ||
938 | vaf.va = &args; | ||
939 | |||
940 | r = ___wiphy_printk(level, wiphy, &vaf); | ||
941 | va_end(args); | ||
942 | |||
943 | return r; | ||
944 | } | ||
945 | EXPORT_SYMBOL(__wiphy_printk); | ||
946 | |||
947 | #define define_wiphy_printk_level(func, kern_level) \ | ||
948 | int func(const struct wiphy *wiphy, const char *fmt, ...) \ | ||
949 | { \ | ||
950 | struct va_format vaf; \ | ||
951 | va_list args; \ | ||
952 | int r; \ | ||
953 | \ | ||
954 | va_start(args, fmt); \ | ||
955 | \ | ||
956 | vaf.fmt = fmt; \ | ||
957 | vaf.va = &args; \ | ||
958 | \ | ||
959 | r = ___wiphy_printk(kern_level, wiphy, &vaf); \ | ||
960 | va_end(args); \ | ||
961 | \ | ||
962 | return r; \ | ||
963 | } \ | ||
964 | EXPORT_SYMBOL(func); | ||
965 | |||
966 | define_wiphy_printk_level(wiphy_debug, KERN_DEBUG); | ||
diff --git a/net/wireless/core.h b/net/wireless/core.h index 58ab2c791d28..37580e090a3d 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -95,7 +95,10 @@ extern struct mutex cfg80211_mutex; | |||
95 | extern struct list_head cfg80211_rdev_list; | 95 | extern struct list_head cfg80211_rdev_list; |
96 | extern int cfg80211_rdev_list_generation; | 96 | extern int cfg80211_rdev_list_generation; |
97 | 97 | ||
98 | #define assert_cfg80211_lock() WARN_ON(!mutex_is_locked(&cfg80211_mutex)) | 98 | static inline void assert_cfg80211_lock(void) |
99 | { | ||
100 | lockdep_assert_held(&cfg80211_mutex); | ||
101 | } | ||
99 | 102 | ||
100 | /* | 103 | /* |
101 | * You can use this to mark a wiphy_idx as not having an associated wiphy. | 104 | * You can use this to mark a wiphy_idx as not having an associated wiphy. |
@@ -202,8 +205,8 @@ static inline void wdev_unlock(struct wireless_dev *wdev) | |||
202 | mutex_unlock(&wdev->mtx); | 205 | mutex_unlock(&wdev->mtx); |
203 | } | 206 | } |
204 | 207 | ||
205 | #define ASSERT_RDEV_LOCK(rdev) WARN_ON(!mutex_is_locked(&(rdev)->mtx)); | 208 | #define ASSERT_RDEV_LOCK(rdev) lockdep_assert_held(&(rdev)->mtx) |
206 | #define ASSERT_WDEV_LOCK(wdev) WARN_ON(!mutex_is_locked(&(wdev)->mtx)); | 209 | #define ASSERT_WDEV_LOCK(wdev) lockdep_assert_held(&(wdev)->mtx) |
207 | 210 | ||
208 | enum cfg80211_event_type { | 211 | enum cfg80211_event_type { |
209 | EVENT_CONNECT_RESULT, | 212 | EVENT_CONNECT_RESULT, |
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 8515b1e5c578..46f371160896 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -882,7 +882,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | |||
882 | if (!wdev->current_bss || | 882 | if (!wdev->current_bss || |
883 | memcmp(wdev->current_bss->pub.bssid, mgmt->bssid, | 883 | memcmp(wdev->current_bss->pub.bssid, mgmt->bssid, |
884 | ETH_ALEN) != 0 || | 884 | ETH_ALEN) != 0 || |
885 | (wdev->iftype == NL80211_IFTYPE_STATION && | 885 | ((wdev->iftype == NL80211_IFTYPE_STATION || |
886 | wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) && | ||
886 | memcmp(wdev->current_bss->pub.bssid, mgmt->da, | 887 | memcmp(wdev->current_bss->pub.bssid, mgmt->da, |
887 | ETH_ALEN) != 0)) { | 888 | ETH_ALEN) != 0)) { |
888 | wdev_unlock(wdev); | 889 | wdev_unlock(wdev); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 85a23de7bff3..f15b1af2c768 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -410,12 +410,14 @@ static int nl80211_key_allowed(struct wireless_dev *wdev) | |||
410 | switch (wdev->iftype) { | 410 | switch (wdev->iftype) { |
411 | case NL80211_IFTYPE_AP: | 411 | case NL80211_IFTYPE_AP: |
412 | case NL80211_IFTYPE_AP_VLAN: | 412 | case NL80211_IFTYPE_AP_VLAN: |
413 | case NL80211_IFTYPE_P2P_GO: | ||
413 | break; | 414 | break; |
414 | case NL80211_IFTYPE_ADHOC: | 415 | case NL80211_IFTYPE_ADHOC: |
415 | if (!wdev->current_bss) | 416 | if (!wdev->current_bss) |
416 | return -ENOLINK; | 417 | return -ENOLINK; |
417 | break; | 418 | break; |
418 | case NL80211_IFTYPE_STATION: | 419 | case NL80211_IFTYPE_STATION: |
420 | case NL80211_IFTYPE_P2P_CLIENT: | ||
419 | if (wdev->sme_state != CFG80211_SME_CONNECTED) | 421 | if (wdev->sme_state != CFG80211_SME_CONNECTED) |
420 | return -ENOLINK; | 422 | return -ENOLINK; |
421 | break; | 423 | break; |
@@ -766,7 +768,8 @@ static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev) | |||
766 | wdev->iftype == NL80211_IFTYPE_AP || | 768 | wdev->iftype == NL80211_IFTYPE_AP || |
767 | wdev->iftype == NL80211_IFTYPE_WDS || | 769 | wdev->iftype == NL80211_IFTYPE_WDS || |
768 | wdev->iftype == NL80211_IFTYPE_MESH_POINT || | 770 | wdev->iftype == NL80211_IFTYPE_MESH_POINT || |
769 | wdev->iftype == NL80211_IFTYPE_MONITOR; | 771 | wdev->iftype == NL80211_IFTYPE_MONITOR || |
772 | wdev->iftype == NL80211_IFTYPE_P2P_GO; | ||
770 | } | 773 | } |
771 | 774 | ||
772 | static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, | 775 | static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, |
@@ -833,7 +836,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
833 | struct cfg80211_registered_device *rdev; | 836 | struct cfg80211_registered_device *rdev; |
834 | struct net_device *netdev = NULL; | 837 | struct net_device *netdev = NULL; |
835 | struct wireless_dev *wdev; | 838 | struct wireless_dev *wdev; |
836 | int result, rem_txq_params = 0; | 839 | int result = 0, rem_txq_params = 0; |
837 | struct nlattr *nl_txq_params; | 840 | struct nlattr *nl_txq_params; |
838 | u32 changed; | 841 | u32 changed; |
839 | u8 retry_short = 0, retry_long = 0; | 842 | u8 retry_short = 0, retry_long = 0; |
@@ -1693,7 +1696,8 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info) | |||
1693 | if (err) | 1696 | if (err) |
1694 | goto unlock_rtnl; | 1697 | goto unlock_rtnl; |
1695 | 1698 | ||
1696 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP) { | 1699 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && |
1700 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { | ||
1697 | err = -EOPNOTSUPP; | 1701 | err = -EOPNOTSUPP; |
1698 | goto out; | 1702 | goto out; |
1699 | } | 1703 | } |
@@ -1785,7 +1789,8 @@ static int nl80211_del_beacon(struct sk_buff *skb, struct genl_info *info) | |||
1785 | goto out; | 1789 | goto out; |
1786 | } | 1790 | } |
1787 | 1791 | ||
1788 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP) { | 1792 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && |
1793 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { | ||
1789 | err = -EOPNOTSUPP; | 1794 | err = -EOPNOTSUPP; |
1790 | goto out; | 1795 | goto out; |
1791 | } | 1796 | } |
@@ -2128,10 +2133,12 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) | |||
2128 | switch (dev->ieee80211_ptr->iftype) { | 2133 | switch (dev->ieee80211_ptr->iftype) { |
2129 | case NL80211_IFTYPE_AP: | 2134 | case NL80211_IFTYPE_AP: |
2130 | case NL80211_IFTYPE_AP_VLAN: | 2135 | case NL80211_IFTYPE_AP_VLAN: |
2136 | case NL80211_IFTYPE_P2P_GO: | ||
2131 | /* disallow mesh-specific things */ | 2137 | /* disallow mesh-specific things */ |
2132 | if (params.plink_action) | 2138 | if (params.plink_action) |
2133 | err = -EINVAL; | 2139 | err = -EINVAL; |
2134 | break; | 2140 | break; |
2141 | case NL80211_IFTYPE_P2P_CLIENT: | ||
2135 | case NL80211_IFTYPE_STATION: | 2142 | case NL80211_IFTYPE_STATION: |
2136 | /* disallow everything but AUTHORIZED flag */ | 2143 | /* disallow everything but AUTHORIZED flag */ |
2137 | if (params.plink_action) | 2144 | if (params.plink_action) |
@@ -2233,7 +2240,8 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | |||
2233 | goto out_rtnl; | 2240 | goto out_rtnl; |
2234 | 2241 | ||
2235 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && | 2242 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && |
2236 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) { | 2243 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && |
2244 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { | ||
2237 | err = -EINVAL; | 2245 | err = -EINVAL; |
2238 | goto out; | 2246 | goto out; |
2239 | } | 2247 | } |
@@ -2286,7 +2294,8 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) | |||
2286 | 2294 | ||
2287 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && | 2295 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && |
2288 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && | 2296 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && |
2289 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) { | 2297 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && |
2298 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { | ||
2290 | err = -EINVAL; | 2299 | err = -EINVAL; |
2291 | goto out; | 2300 | goto out; |
2292 | } | 2301 | } |
@@ -2660,7 +2669,8 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) | |||
2660 | goto out; | 2669 | goto out; |
2661 | } | 2670 | } |
2662 | 2671 | ||
2663 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP) { | 2672 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && |
2673 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { | ||
2664 | err = -EOPNOTSUPP; | 2674 | err = -EOPNOTSUPP; |
2665 | goto out; | 2675 | goto out; |
2666 | } | 2676 | } |
@@ -3363,6 +3373,7 @@ static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
3363 | } | 3373 | } |
3364 | 3374 | ||
3365 | switch (wdev->iftype) { | 3375 | switch (wdev->iftype) { |
3376 | case NL80211_IFTYPE_P2P_CLIENT: | ||
3366 | case NL80211_IFTYPE_STATION: | 3377 | case NL80211_IFTYPE_STATION: |
3367 | if (intbss == wdev->current_bss) | 3378 | if (intbss == wdev->current_bss) |
3368 | NLA_PUT_U32(msg, NL80211_BSS_STATUS, | 3379 | NLA_PUT_U32(msg, NL80211_BSS_STATUS, |
@@ -3649,7 +3660,8 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) | |||
3649 | goto out; | 3660 | goto out; |
3650 | } | 3661 | } |
3651 | 3662 | ||
3652 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { | 3663 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
3664 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
3653 | err = -EOPNOTSUPP; | 3665 | err = -EOPNOTSUPP; |
3654 | goto out; | 3666 | goto out; |
3655 | } | 3667 | } |
@@ -3804,7 +3816,8 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) | |||
3804 | goto out; | 3816 | goto out; |
3805 | } | 3817 | } |
3806 | 3818 | ||
3807 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { | 3819 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
3820 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
3808 | err = -EOPNOTSUPP; | 3821 | err = -EOPNOTSUPP; |
3809 | goto out; | 3822 | goto out; |
3810 | } | 3823 | } |
@@ -3888,7 +3901,8 @@ static int nl80211_deauthenticate(struct sk_buff *skb, struct genl_info *info) | |||
3888 | goto out; | 3901 | goto out; |
3889 | } | 3902 | } |
3890 | 3903 | ||
3891 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { | 3904 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
3905 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
3892 | err = -EOPNOTSUPP; | 3906 | err = -EOPNOTSUPP; |
3893 | goto out; | 3907 | goto out; |
3894 | } | 3908 | } |
@@ -3954,7 +3968,8 @@ static int nl80211_disassociate(struct sk_buff *skb, struct genl_info *info) | |||
3954 | goto out; | 3968 | goto out; |
3955 | } | 3969 | } |
3956 | 3970 | ||
3957 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { | 3971 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
3972 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
3958 | err = -EOPNOTSUPP; | 3973 | err = -EOPNOTSUPP; |
3959 | goto out; | 3974 | goto out; |
3960 | } | 3975 | } |
@@ -4332,7 +4347,8 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
4332 | if (err) | 4347 | if (err) |
4333 | goto unlock_rtnl; | 4348 | goto unlock_rtnl; |
4334 | 4349 | ||
4335 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { | 4350 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
4351 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
4336 | err = -EOPNOTSUPP; | 4352 | err = -EOPNOTSUPP; |
4337 | goto out; | 4353 | goto out; |
4338 | } | 4354 | } |
@@ -4408,7 +4424,8 @@ static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info) | |||
4408 | if (err) | 4424 | if (err) |
4409 | goto unlock_rtnl; | 4425 | goto unlock_rtnl; |
4410 | 4426 | ||
4411 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { | 4427 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
4428 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
4412 | err = -EOPNOTSUPP; | 4429 | err = -EOPNOTSUPP; |
4413 | goto out; | 4430 | goto out; |
4414 | } | 4431 | } |
@@ -4496,7 +4513,8 @@ static int nl80211_setdel_pmksa(struct sk_buff *skb, struct genl_info *info) | |||
4496 | pmksa.pmkid = nla_data(info->attrs[NL80211_ATTR_PMKID]); | 4513 | pmksa.pmkid = nla_data(info->attrs[NL80211_ATTR_PMKID]); |
4497 | pmksa.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); | 4514 | pmksa.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); |
4498 | 4515 | ||
4499 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { | 4516 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
4517 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
4500 | err = -EOPNOTSUPP; | 4518 | err = -EOPNOTSUPP; |
4501 | goto out; | 4519 | goto out; |
4502 | } | 4520 | } |
@@ -4541,7 +4559,8 @@ static int nl80211_flush_pmksa(struct sk_buff *skb, struct genl_info *info) | |||
4541 | if (err) | 4559 | if (err) |
4542 | goto out_rtnl; | 4560 | goto out_rtnl; |
4543 | 4561 | ||
4544 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { | 4562 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
4563 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
4545 | err = -EOPNOTSUPP; | 4564 | err = -EOPNOTSUPP; |
4546 | goto out; | 4565 | goto out; |
4547 | } | 4566 | } |
@@ -4823,7 +4842,8 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
4823 | goto unlock_rtnl; | 4842 | goto unlock_rtnl; |
4824 | 4843 | ||
4825 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && | 4844 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
4826 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) { | 4845 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && |
4846 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
4827 | err = -EOPNOTSUPP; | 4847 | err = -EOPNOTSUPP; |
4828 | goto out; | 4848 | goto out; |
4829 | } | 4849 | } |
@@ -4875,7 +4895,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
4875 | } | 4895 | } |
4876 | 4896 | ||
4877 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && | 4897 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && |
4878 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) { | 4898 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && |
4899 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
4879 | err = -EOPNOTSUPP; | 4900 | err = -EOPNOTSUPP; |
4880 | goto out; | 4901 | goto out; |
4881 | } | 4902 | } |
@@ -5093,7 +5114,8 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, | |||
5093 | goto unlock_rdev; | 5114 | goto unlock_rdev; |
5094 | } | 5115 | } |
5095 | 5116 | ||
5096 | if (wdev->iftype != NL80211_IFTYPE_STATION) { | 5117 | if (wdev->iftype != NL80211_IFTYPE_STATION && |
5118 | wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) { | ||
5097 | err = -EOPNOTSUPP; | 5119 | err = -EOPNOTSUPP; |
5098 | goto unlock_rdev; | 5120 | goto unlock_rdev; |
5099 | } | 5121 | } |
diff --git a/net/wireless/radiotap.c b/net/wireless/radiotap.c index 1332c445d1c7..c774bc0f155e 100644 --- a/net/wireless/radiotap.c +++ b/net/wireless/radiotap.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * See COPYING for more details. | 14 | * See COPYING for more details. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/kernel.h> | ||
17 | #include <net/cfg80211.h> | 18 | #include <net/cfg80211.h> |
18 | #include <net/ieee80211_radiotap.h> | 19 | #include <net/ieee80211_radiotap.h> |
19 | #include <asm/unaligned.h> | 20 | #include <asm/unaligned.h> |
@@ -45,7 +46,7 @@ static const struct radiotap_align_size rtap_namespace_sizes[] = { | |||
45 | }; | 46 | }; |
46 | 47 | ||
47 | static const struct ieee80211_radiotap_namespace radiotap_ns = { | 48 | static const struct ieee80211_radiotap_namespace radiotap_ns = { |
48 | .n_bits = sizeof(rtap_namespace_sizes) / sizeof(rtap_namespace_sizes[0]), | 49 | .n_bits = ARRAY_SIZE(rtap_namespace_sizes), |
49 | .align_size = rtap_namespace_sizes, | 50 | .align_size = rtap_namespace_sizes, |
50 | }; | 51 | }; |
51 | 52 | ||
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index b0d9a08447c9..d14bbf960c18 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -74,7 +74,11 @@ const struct ieee80211_regdomain *cfg80211_regdomain; | |||
74 | * - last_request | 74 | * - last_request |
75 | */ | 75 | */ |
76 | static DEFINE_MUTEX(reg_mutex); | 76 | static DEFINE_MUTEX(reg_mutex); |
77 | #define assert_reg_lock() WARN_ON(!mutex_is_locked(®_mutex)) | 77 | |
78 | static inline void assert_reg_lock(void) | ||
79 | { | ||
80 | lockdep_assert_held(®_mutex); | ||
81 | } | ||
78 | 82 | ||
79 | /* Used to queue up regulatory hints */ | 83 | /* Used to queue up regulatory hints */ |
80 | static LIST_HEAD(reg_requests_list); | 84 | static LIST_HEAD(reg_requests_list); |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index a8c2d6b877ae..f161b9844542 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -411,7 +411,8 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
411 | 411 | ||
412 | ASSERT_WDEV_LOCK(wdev); | 412 | ASSERT_WDEV_LOCK(wdev); |
413 | 413 | ||
414 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) | 414 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && |
415 | wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) | ||
415 | return; | 416 | return; |
416 | 417 | ||
417 | if (wdev->sme_state != CFG80211_SME_CONNECTING) | 418 | if (wdev->sme_state != CFG80211_SME_CONNECTING) |
@@ -548,7 +549,8 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, | |||
548 | 549 | ||
549 | ASSERT_WDEV_LOCK(wdev); | 550 | ASSERT_WDEV_LOCK(wdev); |
550 | 551 | ||
551 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) | 552 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && |
553 | wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) | ||
552 | return; | 554 | return; |
553 | 555 | ||
554 | if (wdev->sme_state != CFG80211_SME_CONNECTED) | 556 | if (wdev->sme_state != CFG80211_SME_CONNECTED) |
@@ -644,7 +646,8 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, | |||
644 | 646 | ||
645 | ASSERT_WDEV_LOCK(wdev); | 647 | ASSERT_WDEV_LOCK(wdev); |
646 | 648 | ||
647 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) | 649 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && |
650 | wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) | ||
648 | return; | 651 | return; |
649 | 652 | ||
650 | if (wdev->sme_state != CFG80211_SME_CONNECTED) | 653 | if (wdev->sme_state != CFG80211_SME_CONNECTED) |
diff --git a/net/wireless/util.c b/net/wireless/util.c index bca32eb8f446..fb5448f7d55a 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -326,7 +326,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | |||
326 | cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { | 326 | cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { |
327 | case cpu_to_le16(IEEE80211_FCTL_TODS): | 327 | case cpu_to_le16(IEEE80211_FCTL_TODS): |
328 | if (unlikely(iftype != NL80211_IFTYPE_AP && | 328 | if (unlikely(iftype != NL80211_IFTYPE_AP && |
329 | iftype != NL80211_IFTYPE_AP_VLAN)) | 329 | iftype != NL80211_IFTYPE_AP_VLAN && |
330 | iftype != NL80211_IFTYPE_P2P_GO)) | ||
330 | return -1; | 331 | return -1; |
331 | break; | 332 | break; |
332 | case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): | 333 | case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): |
@@ -354,7 +355,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | |||
354 | break; | 355 | break; |
355 | case cpu_to_le16(IEEE80211_FCTL_FROMDS): | 356 | case cpu_to_le16(IEEE80211_FCTL_FROMDS): |
356 | if ((iftype != NL80211_IFTYPE_STATION && | 357 | if ((iftype != NL80211_IFTYPE_STATION && |
357 | iftype != NL80211_IFTYPE_MESH_POINT) || | 358 | iftype != NL80211_IFTYPE_P2P_CLIENT && |
359 | iftype != NL80211_IFTYPE_MESH_POINT) || | ||
358 | (is_multicast_ether_addr(dst) && | 360 | (is_multicast_ether_addr(dst) && |
359 | !compare_ether_addr(src, addr))) | 361 | !compare_ether_addr(src, addr))) |
360 | return -1; | 362 | return -1; |
@@ -431,6 +433,7 @@ int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, | |||
431 | switch (iftype) { | 433 | switch (iftype) { |
432 | case NL80211_IFTYPE_AP: | 434 | case NL80211_IFTYPE_AP: |
433 | case NL80211_IFTYPE_AP_VLAN: | 435 | case NL80211_IFTYPE_AP_VLAN: |
436 | case NL80211_IFTYPE_P2P_GO: | ||
434 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); | 437 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); |
435 | /* DA BSSID SA */ | 438 | /* DA BSSID SA */ |
436 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 439 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
@@ -439,6 +442,7 @@ int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, | |||
439 | hdrlen = 24; | 442 | hdrlen = 24; |
440 | break; | 443 | break; |
441 | case NL80211_IFTYPE_STATION: | 444 | case NL80211_IFTYPE_STATION: |
445 | case NL80211_IFTYPE_P2P_CLIENT: | ||
442 | fc |= cpu_to_le16(IEEE80211_FCTL_TODS); | 446 | fc |= cpu_to_le16(IEEE80211_FCTL_TODS); |
443 | /* BSSID SA DA */ | 447 | /* BSSID SA DA */ |
444 | memcpy(hdr.addr1, bssid, ETH_ALEN); | 448 | memcpy(hdr.addr1, bssid, ETH_ALEN); |
@@ -778,7 +782,9 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
778 | 782 | ||
779 | /* if it's part of a bridge, reject changing type to station/ibss */ | 783 | /* if it's part of a bridge, reject changing type to station/ibss */ |
780 | if ((dev->priv_flags & IFF_BRIDGE_PORT) && | 784 | if ((dev->priv_flags & IFF_BRIDGE_PORT) && |
781 | (ntype == NL80211_IFTYPE_ADHOC || ntype == NL80211_IFTYPE_STATION)) | 785 | (ntype == NL80211_IFTYPE_ADHOC || |
786 | ntype == NL80211_IFTYPE_STATION || | ||
787 | ntype == NL80211_IFTYPE_P2P_CLIENT)) | ||
782 | return -EBUSY; | 788 | return -EBUSY; |
783 | 789 | ||
784 | if (ntype != otype) { | 790 | if (ntype != otype) { |
@@ -789,6 +795,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
789 | cfg80211_leave_ibss(rdev, dev, false); | 795 | cfg80211_leave_ibss(rdev, dev, false); |
790 | break; | 796 | break; |
791 | case NL80211_IFTYPE_STATION: | 797 | case NL80211_IFTYPE_STATION: |
798 | case NL80211_IFTYPE_P2P_CLIENT: | ||
792 | cfg80211_disconnect(rdev, dev, | 799 | cfg80211_disconnect(rdev, dev, |
793 | WLAN_REASON_DEAUTH_LEAVING, true); | 800 | WLAN_REASON_DEAUTH_LEAVING, true); |
794 | break; | 801 | break; |
@@ -817,9 +824,11 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
817 | if (dev->ieee80211_ptr->use_4addr) | 824 | if (dev->ieee80211_ptr->use_4addr) |
818 | break; | 825 | break; |
819 | /* fall through */ | 826 | /* fall through */ |
827 | case NL80211_IFTYPE_P2P_CLIENT: | ||
820 | case NL80211_IFTYPE_ADHOC: | 828 | case NL80211_IFTYPE_ADHOC: |
821 | dev->priv_flags |= IFF_DONT_BRIDGE; | 829 | dev->priv_flags |= IFF_DONT_BRIDGE; |
822 | break; | 830 | break; |
831 | case NL80211_IFTYPE_P2P_GO: | ||
823 | case NL80211_IFTYPE_AP: | 832 | case NL80211_IFTYPE_AP: |
824 | case NL80211_IFTYPE_AP_VLAN: | 833 | case NL80211_IFTYPE_AP_VLAN: |
825 | case NL80211_IFTYPE_WDS: | 834 | case NL80211_IFTYPE_WDS: |