summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2016-01-13 14:33:07 +0000
committerstsp <stsp@openbsd.org>2016-01-13 14:33:07 +0000
commit1387c35fa3dfa3acb46b66ca5407578f3b4dfacf (patch)
treef78ecd549b2ceb238fbf98d2b72e99a8c90759b8
parent"Check UDP length for short as well as long values" - apply the fix from (diff)
downloadwireguard-openbsd-1387c35fa3dfa3acb46b66ca5407578f3b4dfacf.tar.xz
wireguard-openbsd-1387c35fa3dfa3acb46b66ca5407578f3b4dfacf.zip
Fix fallout from turbo mode removal commit: Channel initialization
was broken and lots of drivers ran into trouble as a result. ok deraadt@
-rw-r--r--sys/net80211/ieee80211.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 7037051174f..e330f8ec954 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211.c,v 1.57 2016/01/12 09:28:09 stsp Exp $ */
+/* $OpenBSD: ieee80211.c,v 1.58 2016/01/13 14:33:07 stsp Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
@@ -749,8 +749,10 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode)
modeflags = chanflags[mode];
for (i = 0; i <= IEEE80211_CHAN_MAX; i++) {
c = &ic->ic_channels[i];
- if (mode == IEEE80211_MODE_AUTO ||
- (c->ic_flags & modeflags) == modeflags)
+ if (mode == IEEE80211_MODE_AUTO) {
+ if (c->ic_flags != 0)
+ break;
+ } else if ((c->ic_flags & modeflags) == modeflags)
break;
}
if (i > IEEE80211_CHAN_MAX) {
@@ -764,8 +766,10 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode)
memset(ic->ic_chan_active, 0, sizeof(ic->ic_chan_active));
for (i = 0; i <= IEEE80211_CHAN_MAX; i++) {
c = &ic->ic_channels[i];
- if (mode == IEEE80211_MODE_AUTO ||
- (c->ic_flags & modeflags) == modeflags)
+ if (mode == IEEE80211_MODE_AUTO) {
+ if (c->ic_flags != 0)
+ setbit(ic->ic_chan_active, i);
+ } else if ((c->ic_flags & modeflags) == modeflags)
setbit(ic->ic_chan_active, i);
}
/*