diff mbox series

[v2] ap: add station with basic rates configuration

Message ID 20190528091407.25848-1-johannes@sipsolutions.net
State Accepted
Headers show
Series [v2] ap: add station with basic rates configuration | expand

Commit Message

Johannes Berg May 28, 2019, 9:14 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

When a new station is added, let it have some supported rates
(they're empty without this change), using the basic rates
that it must support to connect.

This, together with the kernel-side changes for client-side,
lets us finish the complete auth/assoc handshake with higher
rates than the mandatory ones, without any further config.

However, the downside to this is that a broken station that
doesn't check the basic rates are supported before it tries
to connect will possibly not get any response to its auth
frame.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 src/ap/ieee802_11.c |  6 ++++--
 src/ap/sta_info.c   | 10 ++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

Comments

Jouni Malinen May 28, 2019, 2:59 p.m. UTC | #1
On Tue, May 28, 2019 at 11:14:07AM +0200, Johannes Berg wrote:
> When a new station is added, let it have some supported rates
> (they're empty without this change), using the basic rates
> that it must support to connect.
> 
> This, together with the kernel-side changes for client-side,
> lets us finish the complete auth/assoc handshake with higher
> rates than the mandatory ones, without any further config.
> 
> However, the downside to this is that a broken station that
> doesn't check the basic rates are supported before it tries
> to connect will possibly not get any response to its auth
> frame.

Thanks, applied.
diff mbox series

Patch

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index f050336557fc..741c4c2ecd18 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2324,8 +2324,10 @@  static void handle_auth(struct hostapd_data *hapd,
 		sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_AUTH |
 				WLAN_STA_AUTHORIZED);
 
-		if (hostapd_sta_add(hapd, sta->addr, 0, 0, NULL, 0, 0,
-				    NULL, NULL, NULL, 0,
+		if (hostapd_sta_add(hapd, sta->addr, 0, 0,
+				    sta->supported_rates,
+				    sta->supported_rates_len,
+				    0, NULL, NULL, NULL, 0,
 				    sta->flags, 0, 0, 0, 0)) {
 			hostapd_logger(hapd, sta->addr,
 				       HOSTAPD_MODULE_IEEE80211,
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 98b609c18a60..51d788436548 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -671,6 +671,7 @@  void ap_sta_session_warning_timeout(struct hostapd_data *hapd,
 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
 {
 	struct sta_info *sta;
+	int i;
 
 	sta = ap_get_sta(hapd, addr);
 	if (sta)
@@ -695,6 +696,15 @@  struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
 		return NULL;
 	}
 
+	for (i = 0; i < WLAN_SUPP_RATES_MAX; i++) {
+		if (!hapd->iface->basic_rates)
+			break;
+		if (hapd->iface->basic_rates[i] < 0)
+			break;
+		sta->supported_rates[i] = hapd->iface->basic_rates[i] / 5;
+	}
+	sta->supported_rates_len = i;
+
 	if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) {
 		wpa_printf(MSG_DEBUG, "%s: register ap_handle_timer timeout "
 			   "for " MACSTR " (%d seconds - ap_max_inactivity)",