[PATCH 4/6] PASN: Get own address from PTKSA cache for PASN_DEAUTH

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

 



From: Vinay Gannevaram <quic_vganneva@xxxxxxxxxxx>

PASN_DEAUTH ctrl iface command uses wpas->own_address to send deauth frame
to peer. Since PASN authentication can be done with random src MAC
address, get own address details from PTKSA cache entry of the peer.

Signed-off-by: Vinay Gannevaram <quic_vganneva@xxxxxxxxxxx>
---
 wpa_supplicant/ctrl_iface.c       |  2 +-
 wpa_supplicant/pasn_supplicant.c  | 26 +++++++++++++++++++++++---
 wpa_supplicant/wpa_supplicant_i.h |  3 +--
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index fe79cbbce..d831a805f 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -11220,7 +11220,7 @@ static int wpas_ctrl_iface_pasn_deauthenticate(struct wpa_supplicant *wpa_s,
 		return -1;
 	}
 
-	return wpas_pasn_deauthenticate(wpa_s, wpa_s->own_addr, bssid);
+	return wpas_pasn_deauthenticate(wpa_s, bssid);
 }
 
 #endif /* CONFIG_PASN */
diff --git a/wpa_supplicant/pasn_supplicant.c b/wpa_supplicant/pasn_supplicant.c
index edecfde8d..18e45d803 100644
--- a/wpa_supplicant/pasn_supplicant.c
+++ b/wpa_supplicant/pasn_supplicant.c
@@ -38,6 +38,9 @@ struct wpa_pasn_auth_work {
 	struct wpabuf *comeback;
 };
 
+static int wpa_pasn_deauthenticate(struct wpa_supplicant *wpa_s,
+				   const u8 *own_addr, const u8 *peer_addr);
+
 
 static int wpas_pasn_send_mlme(void *ctx, const u8 *data, size_t data_len,
 			       int noack, unsigned int freq, unsigned int wait)
@@ -788,7 +791,7 @@ static void wpas_pasn_deauth_cb(struct ptksa_cache_entry *entry)
 	 * entry getting freed during deauthentication processing. */
 	os_memcpy(own_addr, entry->own_addr, ETH_ALEN);
 	os_memcpy(peer_addr, entry->addr, ETH_ALEN);
-	wpas_pasn_deauthenticate(wpa_s, own_addr, peer_addr);
+	wpa_pasn_deauthenticate(wpa_s, own_addr, peer_addr);
 }
 
 
@@ -913,8 +916,8 @@ int wpas_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
 }
 
 
-int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *own_addr,
-			     const u8 *peer_addr)
+static int wpa_pasn_deauthenticate(struct wpa_supplicant *wpa_s,
+				   const u8 *own_addr, const u8 *peer_addr)
 {
 	struct wpa_bss *bss;
 	struct wpabuf *buf;
@@ -971,3 +974,20 @@ int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *own_addr,
 
 	return ret;
 }
+
+
+int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *peer_addr)
+{
+	struct ptksa_cache_entry *entry;
+	u8 own_addr[ETH_ALEN];
+
+	entry =	ptksa_cache_get(wpa_s->ptksa, peer_addr, WPA_CIPHER_NONE);
+	if (!entry) {
+		wpa_printf(MSG_DEBUG, "PASN: peer " MACSTR
+			   " not present in PTKSA cache", MAC2STR(peer_addr));
+		return -1;
+	}
+	os_memcpy(own_addr, entry->own_addr, ETH_ALEN);
+
+	return wpa_pasn_deauthenticate(wpa_s, own_addr, peer_addr);
+}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index da8152560..679f6b2e7 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1906,8 +1906,7 @@ int wpas_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
 int wpas_pasn_auth_rx(struct wpa_supplicant *wpa_s,
 		      const struct ieee80211_mgmt *mgmt, size_t len);
 
-int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *own_addr,
-			     const u8 *bssid);
+int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *bssid);
 void wpas_pasn_auth_trigger(struct wpa_supplicant *wpa_s,
 			    struct pasn_auth *pasn_auth);
 void wpas_pasn_auth_work_done(struct wpa_supplicant *wpa_s, int status);
-- 
2.25.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux