summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2016-01-25 15:10:38 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2016-01-25 15:10:38 +0000
commit4c8e10bc8390da477e64975371bd8fc17db254cf (patch)
tree9b20d318abb46c87dd3f932af2da114595c9eb4f /sys
parent71953b628ac9e3df1ab83fefa8611b43d22dbc42 (diff)
Don't try to interpret htprot data if the last beacon didn't contain such data.
ok mpi@ millert@
Diffstat (limited to 'sys')
-rw-r--r--sys/net80211/ieee80211_input.c8
-rw-r--r--sys/net80211/ieee80211_node.c8
-rw-r--r--sys/net80211/ieee80211_node.h4
3 files changed, 11 insertions, 9 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index a1811563a0f..77c48d41bce 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_input.c,v 1.152 2016/01/25 11:27:11 stsp Exp $ */
+/* $OpenBSD: ieee80211_input.c,v 1.153 2016/01/25 15:10:37 stsp Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
@@ -1579,8 +1579,8 @@ 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]))
+ htop = NULL; /* invalid HTOP */
/*
* When operating in station mode, check for state updates
@@ -1603,7 +1603,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
ic->ic_flags &= ~IEEE80211_F_USEPROT;
ic->ic_bss->ni_erp = erp;
}
- if (ic->ic_bss->ni_flags & IEEE80211_NODE_HT) {
+ if (htop && (ic->ic_bss->ni_flags & IEEE80211_NODE_HT)) {
enum ieee80211_htprot htprot_last, htprot;
htprot_last =
((ic->ic_bss->ni_htop1 & IEEE80211_HTOP1_PROT_MASK)
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index f39b8c6f38a..7e30ab8a1f7 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.c,v 1.97 2016/01/07 23:22:31 stsp Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.98 2016/01/25 15:10:37 stsp Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
@@ -1308,12 +1308,12 @@ ieee80211_setup_htcaps(struct ieee80211_node *ni, const uint8_t *data,
/*
* Install received HT op information in the node's state block.
*/
-void
+int
ieee80211_setup_htop(struct ieee80211_node *ni, const uint8_t *data,
uint8_t len)
{
if (len != 22)
- return;
+ return 0;
ni->ni_primary_chan = data[0]; /* XXX corresponds to ni_chan */
@@ -1322,6 +1322,8 @@ ieee80211_setup_htop(struct ieee80211_node *ni, const uint8_t *data,
ni->ni_htop2 = (data[3] | (data[4] << 8));
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 74e1718f59f..92a35d64689 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.h,v 1.52 2016/01/07 23:22:31 stsp Exp $ */
+/* $OpenBSD: ieee80211_node.h,v 1.53 2016/01/25 15:10:37 stsp Exp $ */
/* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */
/*-
@@ -353,7 +353,7 @@ extern void ieee80211_clean_cached(struct ieee80211com *ic);
extern void ieee80211_clean_nodes(struct ieee80211com *, int);
void ieee80211_setup_htcaps(struct ieee80211_node *, const uint8_t *,
uint8_t);
-void ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *,
+int ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *,
uint8_t);
extern int ieee80211_setup_rates(struct ieee80211com *,
struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int);