diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-09-16 08:58:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-09-16 15:46:06 -0400 |
commit | 074ac8df9f93f2a35a356d92fd7f16cd846f0a03 (patch) | |
tree | b6a77291a1eea9a11862ad78e965c1df29e62d43 /net/wireless | |
parent | f799a301abf77b87133d624164d28dc2b521e99d (diff) |
cfg80211/nl80211: introduce p2p device types
This adds P2P-STA and P2P-GO as device types so
we can distinguish between those and normal STA
or AP (respectively) type interfaces.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/core.c | 2 | ||||
-rw-r--r-- | net/wireless/mlme.c | 3 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 56 | ||||
-rw-r--r-- | net/wireless/sme.c | 9 | ||||
-rw-r--r-- | net/wireless/util.c | 15 |
5 files changed, 61 insertions, 24 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index b8191cf86226..ff9615a7ee7a 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -726,6 +726,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb, | |||
726 | dev->ethtool_ops = &cfg80211_ethtool_ops; | 726 | dev->ethtool_ops = &cfg80211_ethtool_ops; |
727 | 727 | ||
728 | if ((wdev->iftype == NL80211_IFTYPE_STATION || | 728 | if ((wdev->iftype == NL80211_IFTYPE_STATION || |
729 | wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || | ||
729 | wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) | 730 | wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) |
730 | dev->priv_flags |= IFF_DONT_BRIDGE; | 731 | dev->priv_flags |= IFF_DONT_BRIDGE; |
731 | break; | 732 | break; |
@@ -734,6 +735,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb, | |||
734 | case NL80211_IFTYPE_ADHOC: | 735 | case NL80211_IFTYPE_ADHOC: |
735 | cfg80211_leave_ibss(rdev, dev, true); | 736 | cfg80211_leave_ibss(rdev, dev, true); |
736 | break; | 737 | break; |
738 | case NL80211_IFTYPE_P2P_CLIENT: | ||
737 | case NL80211_IFTYPE_STATION: | 739 | case NL80211_IFTYPE_STATION: |
738 | wdev_lock(wdev); | 740 | wdev_lock(wdev); |
739 | #ifdef CONFIG_CFG80211_WEXT | 741 | #ifdef CONFIG_CFG80211_WEXT |
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 1d6ef24254fe..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, |
@@ -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/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: |