[PATCH] Include BSS max idle timeout in association request

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

 



If WNM is enabled, then the station can send it preferred max IDLE timeout
in the association request that may or may not be honored by the AP, the
value sent in association response is the final to be used by the
station which is already supported.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@xxxxxxxxxxxxx>
---
Depends on kernel patch: https://patchwork.kernel.org/project/linux-wireless/patch/20230719194039.16179-1-Chaitanya.Tata@xxxxxxxxxxxxx/
---
 src/drivers/driver.h            | 9 +++++++++
 src/drivers/driver_nl80211.c    | 8 ++++++++
 src/drivers/nl80211_copy.h      | 2 ++
 wpa_supplicant/config.c         | 1 +
 wpa_supplicant/config_ssid.h    | 8 ++++++++
 wpa_supplicant/sme.c            | 2 ++
 wpa_supplicant/wpa_cli.c        | 7 ++++++-
 wpa_supplicant/wpa_supplicant.c | 6 ++++++
 8 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 8e462c8b7..cb35dce60 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1320,6 +1320,15 @@ struct wpa_driver_associate_params {
 	 * mld_params - MLD association parameters
 	 */
 	struct wpa_driver_mld_params mld_params;
+
+#ifdef CONFIG_SME
+#ifdef CONFIG_WNM
+	/**
+	 * Preferred maximum IDLE period in TUs
+	 */
+	unsigned short bss_max_idle_period;
+#endif /* CONFIG_WNM */
+#endif /* CONFIG_SME */
 };
 
 enum hide_ssid {
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index e4180daed..f579a9956 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6983,6 +6983,14 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
 	    nla_put_flag(msg, NL80211_ATTR_MLO_SUPPORT))
 		return -1;
 
+	if (params->bss_max_idle_period) {
+		wpa_printf(MSG_DEBUG, "  * BSS max idle period %u seconds",
+			   params->bss_max_idle_period);
+		if (nla_put_u16(msg, NL80211_ATTR_BSS_MAX_IDLE_PERIOD,
+				params->bss_max_idle_period))
+			return -1;
+	}
+
 	return 0;
 }
 
diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
index c59fec406..b1608df96 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -3341,6 +3341,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_EMA_RNR_ELEMS,
 
+	NL80211_ATTR_BSS_MAX_IDLE_PERIOD,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index de9b9b30f..6c95773aa 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2713,6 +2713,7 @@ static const struct parse_data ssid_fields[] = {
 	{ INT_RANGE(sae_pk, 0, 2) },
 	{ INT_RANGE(disable_eht, 0, 1)},
 	{ INT_RANGE(enable_4addr_mode, 0, 1)},
+	{ INT_RANGE(bss_max_idle_period, 0, 65535)}
 };
 
 #undef OFFSET
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index ff045380e..910720102 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -1265,6 +1265,14 @@ struct wpa_ssid {
 	 * to use the interface in a bridge.
 	 */
 	int enable_4addr_mode;
+#ifdef CONFIG_SME
+#ifdef CONFIG_WNM
+	/**
+	 * Preferred maximum IDLE period in TUs.
+	 */
+	unsigned short bss_max_idle_period;
+#endif /* CONFIG_WNM */
+#endif /* CONFIG_SME */
 };
 
 #endif /* CONFIG_SSID_H */
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 4ed0a3003..f8ace8ece 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -2624,6 +2624,8 @@ mscs_fail:
 		}
 	}
 
+	params.bss_max_idle_period = ssid->bss_max_idle_period;
+
 	if (wpa_drv_associate(wpa_s, &params) < 0) {
 		wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the "
 			"driver failed");
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index effc7b3bc..9ce212738 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -1494,7 +1494,12 @@ static const char *network_fields[] = {
 #ifdef CONFIG_HS20
 	"update_identifier",
 #endif /* CONFIG_HS20 */
-	"mac_addr", "pbss", "wps_disabled"
+	"mac_addr", "pbss", "wps_disabled",
+#ifdef CONFIG_SME
+#ifdef CONFIG_WNM
+	"bss_max_idle_period",
+#endif /* CONFIG_WNM */
+#endif /* CONFIG_SME */
 };
 
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index e0f3240e8..f2c0d3d3c 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -4338,6 +4338,12 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
 	params.sae_pwe = wpa_s->conf->sae_pwe;
 #endif /* CONFIG_SAE */
 
+#ifdef CONFIG_SME
+#ifdef CONFIG_WNM
+	params.bss_max_idle_period = ssid->bss_max_idle_period;
+#endif /* CONFIG_WNM */
+#endif /* CONFIG_SME */
+
 	ret = wpa_drv_associate(wpa_s, &params);
 	forced_memzero(psk, sizeof(psk));
 	os_free(wpa_ie);
-- 
2.34.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