Search Linux Wireless

[PATCH 1/1] cfg80211: Allow AP/P2PGO to indicate port authorization to peer STA/P2PClient

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In 4way handshake offload, cfg80211_port_authorized
enables driver to indicate successful 4way handshake to cfg80211 layer.
Currently this path of port authorization is restricted to
interface type NL80211_IFTYPE_STATION and NL80211_IFTYPE_P2P_CLIENT.
This patch extends the support for NL80211_IFTYPE_AP and
NL80211_IFTYPE_P2P_GO interfaces to authorize peer STA/P2P_CLIENT,
whenever authentication is offloaded on the AP/P2P_GO interface.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@xxxxxxxxxxxx>
---
 include/net/cfg80211.h |  8 ++++++--
 net/wireless/sme.c     | 21 +++++++++++++--------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 6d02e12e4702..bdb560c52ade 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -7391,7 +7391,8 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
  * cfg80211_port_authorized - notify cfg80211 of successful security association
  *
  * @dev: network device
- * @bssid: the BSSID of the AP
+ * @peer_mac: BSSID of the AP/P2P GO in case of STA/GC or STA/GC macaddress in
+ *  case of AP/P2P GO
  * @gfp: allocation flags
  *
  * This function should be called by a driver that supports 4 way handshake
@@ -7400,8 +7401,11 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
  * should be preceded with a call to cfg80211_connect_result(),
  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
  * indicate the 802.11 association.
+ * This function can also be called by AP/P2P GO driver that supports
+ * authentication offload. In this case the peer_mac passed is that of
+ * associated STA/GC.
  */
-void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
+void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_mac,
 			      gfp_t gfp);
 
 /**
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index ff4d48fcbfb2..063898377190 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -1027,22 +1027,27 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
 }
 EXPORT_SYMBOL(cfg80211_roamed);
 
-void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid)
+void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *peer_mac)
 {
 	ASSERT_WDEV_LOCK(wdev);
 
-	if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
+	if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION &&
+		wdev->iftype != NL80211_IFTYPE_P2P_CLIENT &&
+		wdev->iftype != NL80211_IFTYPE_AP &&
+		wdev->iftype != NL80211_IFTYPE_P2P_GO))
 		return;
 
-	if (WARN_ON(!wdev->current_bss) ||
-	    WARN_ON(!ether_addr_equal(wdev->current_bss->pub.bssid, bssid)))
+	if ((wdev->iftype == NL80211_IFTYPE_STATION ||
+		wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
+		(WARN_ON(!wdev->current_bss) ||
+		WARN_ON((!ether_addr_equal(wdev->current_bss->pub.bssid, peer_mac)))))
 		return;
 
 	nl80211_send_port_authorized(wiphy_to_rdev(wdev->wiphy), wdev->netdev,
-				     bssid);
+				     peer_mac);
 }
 
-void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
+void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_mac,
 			      gfp_t gfp)
 {
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -1050,7 +1055,7 @@ void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
 	struct cfg80211_event *ev;
 	unsigned long flags;
 
-	if (WARN_ON(!bssid))
+	if (WARN_ON(!peer_mac))
 		return;
 
 	ev = kzalloc(sizeof(*ev), gfp);
@@ -1058,7 +1063,7 @@ void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
 		return;
 
 	ev->type = EVENT_PORT_AUTHORIZED;
-	memcpy(ev->pa.bssid, bssid, ETH_ALEN);
+	memcpy(ev->pa.bssid, peer_mac, ETH_ALEN);
 
 	/*
 	 * Use the wdev event list so that if there are pending
-- 
2.32.0

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux