From f9214ef6b1131cd70d074d414960a8bc72f0ccfb Mon Sep 17 00:00:00 2001 From: stsp Date: Tue, 7 Aug 2018 18:13:14 +0000 Subject: [PATCH] Ignore basic MCS set information found in association responses. Some APs (Aruba 105) send a bogus basic MCS set in assoc responses which prevents us from enabling 11n support with those APs, while these APs still behave as if were were an 11n client which renders the association unusable. The basic MSC set is already provided in beacons anyway, and the 802.11 2012 standard says the basic MSC set is reserved in frames other than beacons (see Table 8-130). ok mpi@ --- sys/net80211/ieee80211_input.c | 6 +++--- sys/net80211/ieee80211_node.c | 7 ++++--- sys/net80211/ieee80211_node.h | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index da2bda6ae9b..a614a67cc59 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_input.c,v 1.201 2018/05/05 06:58:05 stsp Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.202 2018/08/07 18:13:14 stsp Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe @@ -1538,7 +1538,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m, if (htcaps) ieee80211_setup_htcaps(ni, htcaps + 2, htcaps[1]); - if (htop && !ieee80211_setup_htop(ni, htop + 2, htop[1])) + if (htop && !ieee80211_setup_htop(ni, htop + 2, htop[1], 1)) htop = NULL; /* invalid HTOP */ ni->ni_dtimcount = dtim_count; @@ -2314,7 +2314,7 @@ ieee80211_recv_assoc_resp(struct ieee80211com *ic, struct mbuf *m, if (htcaps) ieee80211_setup_htcaps(ni, htcaps + 2, htcaps[1]); if (htop) - ieee80211_setup_htop(ni, htop + 2, htop[1]); + ieee80211_setup_htop(ni, htop + 2, htop[1], 0); ieee80211_ht_negotiate(ic, ni); /* Hop into 11n mode after associating to an HT AP in a non-11n mode. */ diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 3a821b235a2..d3164e8305c 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.c,v 1.138 2018/08/06 11:28:01 stsp Exp $ */ +/* $OpenBSD: ieee80211_node.c,v 1.139 2018/08/07 18:13:14 stsp Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */ /*- @@ -1929,7 +1929,7 @@ ieee80211_clear_htcaps(struct ieee80211_node *ni) */ int ieee80211_setup_htop(struct ieee80211_node *ni, const uint8_t *data, - uint8_t len) + uint8_t len, int isprobe) { if (len != 22) return 0; @@ -1940,7 +1940,8 @@ ieee80211_setup_htop(struct ieee80211_node *ni, const uint8_t *data, ni->ni_htop1 = (data[2] | (data[3] << 8)); ni->ni_htop2 = (data[3] | (data[4] << 8)); - memcpy(ni->ni_basic_mcs, &data[6], sizeof(ni->ni_basic_mcs)); + if (isprobe) + memcpy(ni->ni_basic_mcs, &data[6], sizeof(ni->ni_basic_mcs)); return 1; } diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 882df583190..dd07921bc7e 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.h,v 1.75 2018/07/11 20:18:09 phessler Exp $ */ +/* $OpenBSD: ieee80211_node.h,v 1.76 2018/08/07 18:13:14 stsp Exp $ */ /* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */ /*- @@ -402,7 +402,7 @@ void ieee80211_setup_htcaps(struct ieee80211_node *, const uint8_t *, uint8_t); void ieee80211_clear_htcaps(struct ieee80211_node *); int ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *, - uint8_t); + uint8_t, int); int ieee80211_setup_rates(struct ieee80211com *, struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int); int ieee80211_iserp_sta(const struct ieee80211_node *); -- 2.20.1