[PATCH 05/50] driver_nl80211: Provide link_id in EAPOL_RX and RX_MGMT events

Rameshkumar Sundaram (QUIC) quic_ramess at quicinc.com
Fri Feb 17 03:29:05 PST 2023


> -----Original Message-----
> From: Hostap <hostap-bounces at lists.infradead.org> On Behalf Of Andrei
> Otcheretianski
> Sent: Thursday, February 16, 2023 4:38 AM
> To: hostap at lists.infradead.org
> Cc: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
> Subject: [PATCH 05/50] driver_nl80211: Provide link_id in EAPOL_RX and
> RX_MGMT events
> 
> Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
> ---
>  src/drivers/driver.h               | 14 ++++++++++--
>  src/drivers/driver_nl80211_event.c | 34 +++++++++++++++++++++++-------
>  2 files changed, 38 insertions(+), 10 deletions(-)
> 
> diff --git a/src/drivers/driver.h b/src/drivers/driver.h index
> f2595b02a6..0f225929ab 100644
> --- a/src/drivers/driver.h
> +++ b/src/drivers/driver.h
> @@ -6111,6 +6111,12 @@ union wpa_event_data {
>  		 * ssi_signal - Signal strength in dBm (or 0 if not available)
>  		 */
>  		int ssi_signal;
> +
> +		/**
> +		 * link_id - MLO link on which the frame was received or -1
> for
> +		 * non MLD.
> +		 */
> +		int link_id;
>  	} rx_mgmt;
> 
>  	/**
> @@ -6211,6 +6217,7 @@ union wpa_event_data {
>  		const u8 *data;
>  		size_t data_len;
>  		enum frame_encryption encrypted;
> +		int link_id;
>  	} eapol_rx;
> 
>  	/**
> @@ -6565,12 +6572,14 @@ static inline void drv_event_eapol_rx(void *ctx,
> const u8 *src, const u8 *data,
>  	event.eapol_rx.data = data;
>  	event.eapol_rx.data_len = data_len;
>  	event.eapol_rx.encrypted = FRAME_ENCRYPTION_UNKNOWN;
> +	event.eapol_rx.link_id = -1;
>  	wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);  }
> 
>  static inline void drv_event_eapol_rx2(void *ctx, const u8 *src, const u8
> *data,
> -				      size_t data_len,
> -				       enum frame_encryption encrypted)
> +				       size_t data_len,
> +				       enum frame_encryption encrypted,
> +				       int link_id)
>  {
>  	union wpa_event_data event;
>  	os_memset(&event, 0, sizeof(event));
> @@ -6578,6 +6587,7 @@ static inline void drv_event_eapol_rx2(void *ctx,
> const u8 *src, const u8 *data,
>  	event.eapol_rx.data = data;
>  	event.eapol_rx.data_len = data_len;
>  	event.eapol_rx.encrypted = encrypted;
> +	event.eapol_rx.link_id = link_id;
>  	wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);  }
> 
> diff --git a/src/drivers/driver_nl80211_event.c
> b/src/drivers/driver_nl80211_event.c
> index 3469db1c7e..4b70c3fcb6 100644
> --- a/src/drivers/driver_nl80211_event.c
> +++ b/src/drivers/driver_nl80211_event.c
> @@ -1111,7 +1111,8 @@ static void mlme_timeout_event(struct
> wpa_driver_nl80211_data *drv,
> 
>  static void mlme_event_mgmt(struct i802_bss *bss,
>  			    struct nlattr *freq, struct nlattr *sig,
> -			    const u8 *frame, size_t len)
> +			    const u8 *frame, size_t len,
> +			    int link_id)
>  {
>  	struct wpa_driver_nl80211_data *drv = bss->drv;
>  	const struct ieee80211_mgmt *mgmt;
> @@ -1149,6 +1150,8 @@ static void mlme_event_mgmt(struct i802_bss
> *bss,
>  	event.rx_mgmt.frame_len = len;
>  	event.rx_mgmt.ssi_signal = ssi_signal;
>  	event.rx_mgmt.drv_priv = bss;
> +	event.rx_mgmt.link_id = link_id;
> +
>  	wpa_supplicant_event(drv->ctx, EVENT_RX_MGMT, &event);  }
> 
> @@ -1403,12 +1406,14 @@ static void mlme_event(struct i802_bss *bss,
>  		       struct nlattr *addr, struct nlattr *timed_out,
>  		       struct nlattr *freq, struct nlattr *ack,
>  		       struct nlattr *cookie, struct nlattr *sig,
> -		       struct nlattr *wmm, struct nlattr *req_ie)
> +		       struct nlattr *wmm, struct nlattr *req_ie,
> +		       struct nlattr *link)
>  {
>  	struct wpa_driver_nl80211_data *drv = bss->drv;
>  	u16 stype = 0, auth_type = 0;
>  	const u8 *data;
>  	size_t len;
> +	int link_id;
> 
>  	if (timed_out && addr) {
>  		mlme_timeout_event(drv, cmd, addr);
> @@ -1422,6 +1427,11 @@ static void mlme_event(struct i802_bss *bss,
>  		return;
>  	}
> 
> +	if (link)
> +		link_id = nla_get_u8(link);
> +	else
> +		link_id = -1;
> +
>  	data = nla_data(frame);
>  	len = nla_len(frame);
>  	if (len < 4 + 2 * ETH_ALEN) {
> @@ -1432,10 +1442,10 @@ static void mlme_event(struct i802_bss *bss,
>  		return;
>  	}
>  	wpa_printf(MSG_MSGDUMP, "nl80211: MLME event %d (%s) on %s("
> MACSTR
> -		   ") A1=" MACSTR " A2=" MACSTR, cmd,
> +		   ") A1=" MACSTR " A2=" MACSTR " on link_id=%d", cmd,
>  		   nl80211_command_to_string(cmd), bss->ifname,
>  		   MAC2STR(bss->addr), MAC2STR(data + 4),
> -		   MAC2STR(data + 4 + ETH_ALEN));
> +		   MAC2STR(data + 4 + ETH_ALEN), link_id);
> 
>  	/* PASN Authentication frame can be received with a different source
> MAC
>  	 * address. Allow NL80211_CMD_FRAME event with foreign
> addresses also.
> @@ -1489,7 +1499,7 @@ static void mlme_event(struct i802_bss *bss,
>  		break;
>  	case NL80211_CMD_FRAME:
>  		mlme_event_mgmt(bss, freq, sig, nla_data(frame),
> -				nla_len(frame));
> +				nla_len(frame), link_id);
>  		break;
>  	case NL80211_CMD_FRAME_TX_STATUS:
>  		mlme_event_mgmt_tx_status(drv, cookie, nla_data(frame),
> @@ -3269,6 +3279,7 @@ static void nl80211_control_port_frame(struct
> wpa_driver_nl80211_data *drv,
>  	u8 *src_addr;
>  	u16 ethertype;
>  	enum frame_encryption encrypted;
> +	int link_id;
> 
>  	if (!tb[NL80211_ATTR_MAC] ||
>  	    !tb[NL80211_ATTR_FRAME] ||
> @@ -3280,6 +3291,11 @@ static void nl80211_control_port_frame(struct
> wpa_driver_nl80211_data *drv,
>  	encrypted =
> nla_get_flag(tb[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]) ?
>  		FRAME_NOT_ENCRYPTED : FRAME_ENCRYPTED;
> 
> +	if (tb[NL80211_ATTR_MLO_LINK_ID])
Is there any non upstreamed kernel change that sends link id in NL80211_CMD_CONTROL_PORT_FRAME?
> +		link_id = nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]);




More information about the Hostap mailing list