aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c58
1 files changed, 40 insertions, 18 deletions
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
772static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, 775static 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 }