[PATCH v2 1/1] hostapd: Avoid EAPOL trigger in reassoc path for AP, in case of 4way HS offload

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

 



Currently avoiding of EAPOL exchange for AP with 4way HS offload is
handled only in new STA assoc path. Current change avoids complete
authentication trigger in case of AP reassoc path as well.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@xxxxxxxxxxxx>
---
v1->v2 : Addressed review comments to avoid EAPOL for new and
reassoc paths.
---
 src/ap/wpa_auth.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index 8304c6047..e2970f003 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -367,6 +367,15 @@ static inline int wpa_auth_start_ampe(struct wpa_authenticator *wpa_auth,
 #endif /* CONFIG_MESH */
 
 
+static inline int wpa_auth_get_drv_flags(struct wpa_authenticator *wpa_auth,
+				    u64 *drv_flags, u64 *drv_flags2)
+{
+	if(!wpa_auth->cb->get_drv_flags)
+		return -1;
+	return wpa_auth->cb->get_drv_flags(wpa_auth->cb_ctx, drv_flags,
+	                drv_flags2);
+}
+
 int wpa_auth_for_each_sta(struct wpa_authenticator *wpa_auth,
 			  int (*cb)(struct wpa_state_machine *sm, void *ctx),
 			  void *cb_ctx)
@@ -963,6 +972,9 @@ wpa_auth_sta_init(struct wpa_authenticator *wpa_auth, const u8 *addr,
 int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
 			    struct wpa_state_machine *sm)
 {
+	u64 drv_flags = 0;
+	u64 drv_flags2 = 0;
+
 	if (!wpa_auth || !wpa_auth->conf.wpa || !sm)
 		return -1;
 
@@ -1002,7 +1014,17 @@ int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
 	if (wpa_sm_step(sm) == 1)
 		return 1; /* should not really happen */
 	sm->Init = false;
-	sm->AuthenticationRequest = true;
+
+	if (wpa_auth_get_drv_flags(sm->wpa_auth, &drv_flags, &drv_flags2)) {
+		wpa_auth_logger(wpa_auth, sm->addr, LOGGER_WARNING,
+				"Failed to get driver flags");
+		return 1;
+	}
+	if (drv_flags2 & WPA_DRIVER_FLAGS2_4WAY_HANDSHAKE_AP_PSK)
+		wpa_auth_logger(wpa_auth, sm->addr, LOGGER_INFO,
+				"Skip EAPOL for 4way HS offload case");
+	else
+		sm->AuthenticationRequest = true;
 	return wpa_sm_step(sm);
 }
 
@@ -2299,6 +2321,8 @@ void wpa_remove_ptk(struct wpa_state_machine *sm)
 int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
 {
 	int remove_ptk = 1;
+	u64 drv_flags = 0;
+	u64 drv_flags2 = 0;
 
 	if (!sm)
 		return -1;
@@ -2347,7 +2371,15 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
 			if (wpa_sm_step(sm) == 1)
 				return 1; /* should not really happen */
 			sm->Init = false;
-			sm->AuthenticationRequest = true;
+
+			if (wpa_auth_get_drv_flags(sm->wpa_auth, &drv_flags, &drv_flags2)) {
+				wpa_printf(MSG_ERROR, "Failed to get driver flags");
+				return 1;
+			}
+			if (drv_flags2 & WPA_DRIVER_FLAGS2_4WAY_HANDSHAKE_AP_PSK)
+				wpa_printf(MSG_INFO, "Skip EAPOL for 4way HS offload case");
+			else
+				sm->AuthenticationRequest = true;
 			break;
 		}
 
-- 
2.43.4


_______________________________________________
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