[PATCH 1/1] TD Bitmap: Set transition disable value received from port authorized event.

Vinayak Yadawad vinayak.yadawad at broadcom.com
Tue Dec 6 01:22:27 PST 2022


In case of drivers involving 4-way HS offloaded to driver, there
currently exist no way of updating transition disable bitmap
recieved as part EAPOL 3/4.
With latest provisions in cfg80211_port_authorized, the td bitmap
can be sent to the upper layer. In the current change the same
is parsed as part port authorized event and according transition
disable is set.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad at broadcom.com>
---
 src/drivers/driver.h               |  7 +++++++
 src/drivers/driver_nl80211_event.c | 11 ++++++++++-
 src/drivers/nl80211_copy.h         |  4 ++++
 wpa_supplicant/events.c            |  6 ++++++
 wpa_supplicant/wpas_glue.c         |  2 +-
 wpa_supplicant/wpas_glue.h         |  1 +
 6 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 0b019e3af..adbf18a61 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -6365,6 +6365,13 @@ union wpa_event_data {
 	 */
 	struct pasn_auth pasn_auth;
 
+	/**
+	 * struct port_authorized - Data for EVENT_PORT_AUTHORIZED
+	 */
+	struct port_authorized {
+		u8 *td_bitmap;
+		u8 td_bitmap_len;
+	} port_authorized;
 };
 
 /**
diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index 8f0361fd8..091ab40db 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -3152,7 +3152,9 @@ static void nl80211_port_authorized(struct wpa_driver_nl80211_data *drv,
 				    struct nlattr **tb)
 {
 	const u8 *addr;
+	union wpa_event_data event;
 
+	os_memset(&event, 0, sizeof(event));
 	if (!tb[NL80211_ATTR_MAC] ||
 	    nla_len(tb[NL80211_ATTR_MAC]) != ETH_ALEN) {
 		wpa_printf(MSG_DEBUG,
@@ -3169,7 +3171,14 @@ static void nl80211_port_authorized(struct wpa_driver_nl80211_data *drv,
 		return;
 	}
 
-	wpa_supplicant_event(drv->ctx, EVENT_PORT_AUTHORIZED, NULL);
+	if (tb[NL80211_ATTR_TD_BITMAP]) {
+		event.port_authorized.td_bitmap_len = nla_len(tb[NL80211_ATTR_TD_BITMAP]);
+		if (event.port_authorized.td_bitmap_len > 0) {
+			event.port_authorized.td_bitmap = nla_data(tb[NL80211_ATTR_TD_BITMAP]);
+		}
+	}
+
+	wpa_supplicant_event(drv->ctx, EVENT_PORT_AUTHORIZED, &event);
 }
 
 
diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
index ffb7c573e..3b9fb11ea 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -2741,6 +2741,8 @@ enum nl80211_commands {
  *	When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX
  *	timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
  *	the incoming frame RX timestamp.
+ * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent
+ *  (re)associations.
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3269,6 +3271,8 @@ enum nl80211_attrs {
 	NL80211_ATTR_TX_HW_TIMESTAMP,
 	NL80211_ATTR_RX_HW_TIMESTAMP,
 
+	NL80211_ATTR_TD_BITMAP,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index fe8ab50ff..fff58f684 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -6047,6 +6047,12 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 		break;
 #endif /* CONFIG_PASN */
 	case EVENT_PORT_AUTHORIZED:
+		if (data->port_authorized.td_bitmap_len) {
+			wpa_printf(MSG_INFO, "TD_BITMAP: 0x%x",
+				data->port_authorized.td_bitmap[0]);
+			wpa_supplicant_transition_disable(wpa_s,
+				data->port_authorized.td_bitmap[0]);
+		}
 		wpa_supplicant_event_port_authorized(wpa_s);
 		break;
 	case EVENT_STATION_OPMODE_CHANGED:
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index a309ea278..49994ac68 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -1282,7 +1282,7 @@ static void disable_wpa_wpa2(struct wpa_ssid *ssid)
 }
 
 
-static void wpa_supplicant_transition_disable(void *_wpa_s, u8 bitmap)
+void wpa_supplicant_transition_disable(void *_wpa_s, u8 bitmap)
 {
 	struct wpa_supplicant *wpa_s = _wpa_s;
 	struct wpa_ssid *ssid;
diff --git a/wpa_supplicant/wpas_glue.h b/wpa_supplicant/wpas_glue.h
index 338af4e65..2ceb56d56 100644
--- a/wpa_supplicant/wpas_glue.h
+++ b/wpa_supplicant/wpas_glue.h
@@ -27,4 +27,5 @@ enum wpa_ctrl_req_type wpa_supplicant_ctrl_req_from_string(const char *field);
 void wpas_send_ctrl_req(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
 			const char *field_name, const char *txt);
 
+void wpa_supplicant_transition_disable(void *_wpa_s, u8 bitmap);
 #endif /* WPAS_GLUE_H */
-- 
2.32.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4218 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20221206/48ccbc1a/attachment-0001.p7s>


More information about the Hostap mailing list