summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2016-11-19 21:07:09 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2016-11-19 21:07:09 +0000
commit4e68af8cac04561133c4df256b87b5deb9d65599 (patch)
treeb5c0a37c2fec4afb0c83203956d7676b8109a240
parent4e816f9e303bcc4f056e49fa9d09f07b0d06ed18 (diff)
While setting up the basic rate bitmask for iwm's firmware, if the AP does
not specify basic rates for either the CCK or OFDM set, add just the most basic rate to that set (1 Mbit/s in case of CCK, 6 Mbit/s in case of OFDM). This behaviour matches what code comments seem to imply. The previous code would add all possible basic rates in such cases. So if all basic rates were CCK only, the code would add all possible OFDM basic rates on top. Then the firmware would send some frames at too high rates, e.g. RTS frames would be sent at 24Mbit/s which is a bit risky on noisy channels. ok tb@
-rw-r--r--sys/dev/pci/if_iwm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 2388e4954ea..1a987fed354 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.147 2016/11/17 14:12:33 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -4896,8 +4896,8 @@ iwm_ack_rates(struct iwm_softc *sc, struct iwm_node *in, int *cck_rates,
{
struct ieee80211_node *ni = &in->in_ni;
struct ieee80211_rateset *rs = &ni->ni_rates;
- int lowest_present_ofdm = 100;
- int lowest_present_cck = 100;
+ int lowest_present_ofdm = -1;
+ int lowest_present_cck = -1;
uint8_t cck = 0;
uint8_t ofdm = 0;
int i;
@@ -4908,7 +4908,7 @@ iwm_ack_rates(struct iwm_softc *sc, struct iwm_node *in, int *cck_rates,
if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
continue;
cck |= (1 << i);
- if (lowest_present_cck > i)
+ if (lowest_present_cck == -1 || lowest_present_cck > i)
lowest_present_cck = i;
}
}
@@ -4916,7 +4916,7 @@ iwm_ack_rates(struct iwm_softc *sc, struct iwm_node *in, int *cck_rates,
if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
continue;
ofdm |= (1 << (i - IWM_FIRST_OFDM_RATE));
- if (lowest_present_ofdm > i)
+ if (lowest_present_ofdm == -1 || lowest_present_ofdm > i)
lowest_present_ofdm = i;
}