aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/mlme.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/mlme.c')
-rw-r--r--net/wireless/mlme.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 1cdb1d5e6b0f..8016fee0752b 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -612,10 +612,21 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp)
612} 612}
613EXPORT_SYMBOL(cfg80211_del_sta); 613EXPORT_SYMBOL(cfg80211_del_sta);
614 614
615void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
616 enum nl80211_connect_failed_reason reason,
617 gfp_t gfp)
618{
619 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
620 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
621
622 nl80211_send_conn_failed_event(rdev, dev, mac_addr, reason, gfp);
623}
624EXPORT_SYMBOL(cfg80211_conn_failed);
625
615struct cfg80211_mgmt_registration { 626struct cfg80211_mgmt_registration {
616 struct list_head list; 627 struct list_head list;
617 628
618 u32 nlpid; 629 u32 nlportid;
619 630
620 int match_len; 631 int match_len;
621 632
@@ -624,7 +635,7 @@ struct cfg80211_mgmt_registration {
624 u8 match[]; 635 u8 match[];
625}; 636};
626 637
627int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid, 638int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid,
628 u16 frame_type, const u8 *match_data, 639 u16 frame_type, const u8 *match_data,
629 int match_len) 640 int match_len)
630{ 641{
@@ -672,7 +683,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
672 683
673 memcpy(nreg->match, match_data, match_len); 684 memcpy(nreg->match, match_data, match_len);
674 nreg->match_len = match_len; 685 nreg->match_len = match_len;
675 nreg->nlpid = snd_pid; 686 nreg->nlportid = snd_portid;
676 nreg->frame_type = cpu_to_le16(frame_type); 687 nreg->frame_type = cpu_to_le16(frame_type);
677 list_add(&nreg->list, &wdev->mgmt_registrations); 688 list_add(&nreg->list, &wdev->mgmt_registrations);
678 689
@@ -685,7 +696,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
685 return err; 696 return err;
686} 697}
687 698
688void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid) 699void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid)
689{ 700{
690 struct wiphy *wiphy = wdev->wiphy; 701 struct wiphy *wiphy = wdev->wiphy;
691 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 702 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
@@ -694,7 +705,7 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid)
694 spin_lock_bh(&wdev->mgmt_registrations_lock); 705 spin_lock_bh(&wdev->mgmt_registrations_lock);
695 706
696 list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) { 707 list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) {
697 if (reg->nlpid != nlpid) 708 if (reg->nlportid != nlportid)
698 continue; 709 continue;
699 710
700 if (rdev->ops->mgmt_frame_register) { 711 if (rdev->ops->mgmt_frame_register) {
@@ -710,8 +721,8 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid)
710 721
711 spin_unlock_bh(&wdev->mgmt_registrations_lock); 722 spin_unlock_bh(&wdev->mgmt_registrations_lock);
712 723
713 if (nlpid == wdev->ap_unexpected_nlpid) 724 if (nlportid == wdev->ap_unexpected_nlportid)
714 wdev->ap_unexpected_nlpid = 0; 725 wdev->ap_unexpected_nlportid = 0;
715} 726}
716 727
717void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev) 728void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev)
@@ -736,7 +747,6 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
736 const u8 *buf, size_t len, bool no_cck, 747 const u8 *buf, size_t len, bool no_cck,
737 bool dont_wait_for_ack, u64 *cookie) 748 bool dont_wait_for_ack, u64 *cookie)
738{ 749{
739 struct net_device *dev = wdev->netdev;
740 const struct ieee80211_mgmt *mgmt; 750 const struct ieee80211_mgmt *mgmt;
741 u16 stype; 751 u16 stype;
742 752
@@ -796,7 +806,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
796 case NL80211_IFTYPE_AP: 806 case NL80211_IFTYPE_AP:
797 case NL80211_IFTYPE_P2P_GO: 807 case NL80211_IFTYPE_P2P_GO:
798 case NL80211_IFTYPE_AP_VLAN: 808 case NL80211_IFTYPE_AP_VLAN:
799 if (!ether_addr_equal(mgmt->bssid, dev->dev_addr)) 809 if (!ether_addr_equal(mgmt->bssid, wdev_address(wdev)))
800 err = -EINVAL; 810 err = -EINVAL;
801 break; 811 break;
802 case NL80211_IFTYPE_MESH_POINT: 812 case NL80211_IFTYPE_MESH_POINT:
@@ -809,6 +819,11 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
809 * cfg80211 doesn't track the stations 819 * cfg80211 doesn't track the stations
810 */ 820 */
811 break; 821 break;
822 case NL80211_IFTYPE_P2P_DEVICE:
823 /*
824 * fall through, P2P device only supports
825 * public action frames
826 */
812 default: 827 default:
813 err = -EOPNOTSUPP; 828 err = -EOPNOTSUPP;
814 break; 829 break;
@@ -819,7 +834,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
819 return err; 834 return err;
820 } 835 }
821 836
822 if (!ether_addr_equal(mgmt->sa, dev->dev_addr)) 837 if (!ether_addr_equal(mgmt->sa, wdev_address(wdev)))
823 return -EINVAL; 838 return -EINVAL;
824 839
825 /* Transmit the Action frame as requested by user space */ 840 /* Transmit the Action frame as requested by user space */
@@ -868,7 +883,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
868 /* found match! */ 883 /* found match! */
869 884
870 /* Indicate the received Action frame to user space */ 885 /* Indicate the received Action frame to user space */
871 if (nl80211_send_mgmt(rdev, wdev, reg->nlpid, 886 if (nl80211_send_mgmt(rdev, wdev, reg->nlportid,
872 freq, sig_mbm, 887 freq, sig_mbm,
873 buf, len, gfp)) 888 buf, len, gfp))
874 continue; 889 continue;