[PATCH] wpa_supplicant: support IBSS RSN STA authorization

Antonio Quartulli ordex at autistici.org
Tue Jan 17 09:03:02 EST 2012


In IBSS RSN cfg80211/mac80211 now waits for userspace to authorize new stations.
This patch makes wpa_supplicant notify the driver when a station can be
considered authorised.

Signed-hostap: Antonio Quartulli <ordex at autistici.org>
---

This patch depends on the not yet committed one:
"cfg80211/mac80211: userspace peer authorization in IBSS"
which is pending on the linux-wireless mailing-list



 src/drivers/driver_nl80211.c |    3 +++
 wpa_supplicant/ibss_rsn.c    |   18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 6af8cc9..791f15a 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6397,6 +6397,9 @@ retry:
 	if (ret)
 		goto nla_put_failure;
 
+	if (params->key_mgmt_suite == KEY_MGMT_802_1X)
+		NLA_PUT_FLAG(msg, NL80211_ATTR_CONTROL_PORT);
+
 	if (params->wpa_ie) {
 		wpa_hexdump(MSG_DEBUG,
 			    "  * Extra IEs for Beacon/Probe Response frames",
diff --git a/wpa_supplicant/ibss_rsn.c b/wpa_supplicant/ibss_rsn.c
index d4fa39d..40fc7e0 100644
--- a/wpa_supplicant/ibss_rsn.c
+++ b/wpa_supplicant/ibss_rsn.c
@@ -19,6 +19,7 @@
 #include "rsn_supp/wpa.h"
 #include "rsn_supp/wpa_ie.h"
 #include "ap/wpa_auth.h"
+#include "ap/wpa_auth_i.h"
 #include "wpa_supplicant_i.h"
 #include "driver_i.h"
 #include "ibss_rsn.h"
@@ -545,7 +546,7 @@ static int ibss_rsn_process_rx_eapol(struct ibss_rsn *ibss_rsn,
 				     struct ibss_rsn_peer *peer,
 				     const u8 *buf, size_t len)
 {
-	int supp;
+	int supp, res;
 	u8 *tmp;
 
 	supp = ibss_rsn_eapol_dst_supp(buf, len);
@@ -562,6 +563,21 @@ static int ibss_rsn_process_rx_eapol(struct ibss_rsn *ibss_rsn,
 	} else {
 		wpa_printf(MSG_DEBUG, "RSN: IBSS RX EAPOL for Authenticator");
 		wpa_receive(ibss_rsn->auth_group, peer->auth, tmp, len);
+		/* check if the peer has been authorized */
+		if (peer->auth->wpa_ptk_state == WPA_PTK_PTKINITDONE) {
+			res = wpa_drv_sta_set_flags(ibss_rsn->wpa_s, peer->addr,
+						    WPA_STA_AUTHORIZED,
+						    WPA_STA_AUTHORIZED,
+						    0xFFFFFFFF);
+			if (res < 0)
+				wpa_printf(MSG_DEBUG, "RSN: Error while "
+					   "authorising STA " MACSTR,
+					   MAC2STR(peer->addr));
+			else
+				wpa_printf(MSG_DEBUG, "RSN: STA " MACSTR
+					   " authorised.\n",
+					   MAC2STR(peer->addr));
+		}
 	}
 	os_free(tmp);
 
-- 
1.7.3.4



More information about the HostAP mailing list