summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2016-11-19 21:07:08 +0000
committerstsp <stsp@openbsd.org>2016-11-19 21:07:08 +0000
commit3e25a2d0f65d04b4211900dc50e8de7b300a1949 (patch)
treed26a39e3cda3c5a7a9da5475a0285b1279b935df
parentMake tcpdump indicate basic rates listed in beacons with an asterisk. (diff)
downloadwireguard-openbsd-3e25a2d0f65d04b4211900dc50e8de7b300a1949.tar.xz
wireguard-openbsd-3e25a2d0f65d04b4211900dc50e8de7b300a1949.zip
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;
}