summaryrefslogtreecommitdiff
path: root/sys/net80211
AgeCommit message (Collapse)Author
2017-06-03Explicitly zero out the wepseed for TKIP and WEP.Theo Buehler
ok stsp
2017-06-02Scale the missed beacon counter threshold to the AP's beacon interval.Stefan Sperling
This should make fading APs time out consistently regardless of what the beacon interval is set to (range is 1 to 2^16 TU, though in practice 100 TU seems to be a common value). Print the beacon interval and missed beacon counter threshold to dmesg if the DEBUG flag was set on the wireless interface with ifconfig(8). This should help with diagnosing any issues that pop up. Requested and diff eye-balled by kettenis@ help & ok tb@ phessler@
2017-05-31The net80211 stack was providing a 'beacon miss timeout' value (in ms)Stefan Sperling
which specified how much time may elapse without beacons before drivers begin searching for a new AP. Drivers convert this timeout value into the amount of beacons they're allowed to miss. Having the stack provide this number upfront simplifies things. ok mpi@
2017-05-30Improve the new ieee80211_{min,max}_rates() APIs and fix regressions.Stefan Sperling
Instead of returning an index into ni_rates, return the RVAL of the basic rate we want to use. This allows a driver to unambiguously map the basic rate to the corresponding hardware-specific rate value, and reduces the possibility of bugs where indices are used with arrays they weren't intended for. Adjust iwn(4) accordingly, and use the lowest instead of the highest basic rate in iwn_tx() to cope better in noisy environments. Fixes association problems on 5GHz reported by tb@
2017-05-30Introduce ieee80211_min_basic_rate() and ieee80211_max_basic_rate().Stefan Sperling
These helpers can be used by drivers to improve compatibility with APs that disable some mandatory PHY rates in the basic rate set. For instance, many of our drivers hard-code 11b rates on 2 Ghz and run into problems when APs disable them. Since 11b rates are being disabled by default by some vendors, hardcoding them is not a good idea anymore. ok mpi@ phessler@
2017-05-30Always set the link state DOWN once we enter ieee80211_newstate(), regardlessStefan Sperling
of whether the wifi interface happens to be leaving RUN state. The interface is never usable during state transitions so setting the link DOWN is the only reasonable option when any transition is triggered. Fixes a problem where, at boot time, the link state of wifi interfaces was reported to userland as UNKNOWN (which, curiously, has value 0). dhclient's link detection logic was recently changed from ifmedia to getifaddrs which exposed the UNKOWN link state. Since dhclient assumes an UNKNOWN link state means UP it would start trying to negotiate a lease too early during boot. Problem reported by tb@ ok krw@
2017-05-02Switch 802.11 crypto over to the new AESMike Belopuhov
OK stsp@
2017-05-02Fix a problem with associating to wifi networks with a hidden SSID.Stefan Sperling
If an AP is configured to hide its SSID it sends a non-zero length SSID which contains only zeroes. The AP sends its actual SSID only in probe responses after a client includes this SSID in a probe request. If we happened to receive a beacon before the probe response we stored a non-zero-length SSID of zeroes and never updated the SSID when the probe response arrived. The client was then unable to find the AP. test & ok jung@
2017-04-23Handle unequal numbers of Tx and Rx streams in MiRA.Stefan Sperling
Problem reported by Colton Lewis on misc@ ok tb@
2017-04-11Partially revert previous mallocarray conversions that containDavid Hill
constants. The consensus is that if both operands are constant, we don't need mallocarray. Reminded by tedu@ ok deraadt@
2017-04-09Convert a malloc(9) to mallocarray(9)David Hill
ok deraadt@
2017-03-23Use explicit_bzero() to wipe out key material and add some sizes to free().Theo Buehler
ok stsp
2017-03-21When a new WPA key is set while WEP is enabled, disable WEP,Stefan Sperling
and when a new WEP key is set while WPA is enabled, disable WPA. Prevents unusable configurations where both WEP and WPA are active and makes switching between WEP/WPA networks easier. ok deraadt@ tb@ sthen@
2017-03-13Make 'ifconfig scan' show WPA information for other APs correctly whileStefan Sperling
the interface operates in hostap mode. test & ok tb@
2017-03-12Introduce separate fields for supported WPA protocols and AKMs in structStefan Sperling
ieee80211_node. Pass these fields to 'ifconfig scan' instead of giving it currently configured/enabled settings. Fixes display of AP WPA capabilities in 'ifconfig scan' while the wifi interface is not configured to use WPA (my previous commit attempted to fix the same problem but didn't make it work in all cases). ok tb@
2017-03-11Make 'ifconfig scan' display AP encryption correctly if WEP is configuredStefan Sperling
on the local wifi interface. ifconfig was mistakenly showing the common supported subset of client and AP, rather than showing the AP's capabilities. Exposes WPA protocol capabilities in struct ieee80211_nodereq, which means ifconfig must be recompiled to run on a new kernel. ok deraadt@ mpi@
2017-03-04In 11n hostap mode, dynamically adjust HT protection settings based onStefan Sperling
the presence of non-HT nodes in the node cache. OpenBSD 11n APs will now disable HT protection if it is not necessary. ok mpi@
2017-03-02Initialize 'ni' pointer in ieee80211_keyrun(). Fallout from last minuteStefan Sperling
changes I made to my WPA security patch. Affects WPA enterprise only. Problem found by patrick@ ok sthen@
2017-03-01Fix some DPRINTFs I just added to ieee80211_pae_input.c.Stefan Sperling
No fnuctional change.
2017-03-01Fix a bug allowing a man-in-the-middle attack against WPA wireless clients.Stefan Sperling
A malicious AP could trick clients into connecting to the malicious AP instead of the desired AP. All frames would then be sent in the clear. This problem was found and reported by Mathy Vanhoef who also provided an initial patch which we improved together.
2017-02-07Enable the short slot time feature in 802.11n mode.Stefan Sperling
ok mpi@
2017-02-03Fix 11b clients sending bogus ratesets in association requests. The commonStefan Sperling
rateset with the AP is calculated only after the association response was received, which is too late. Fix rates when an AP is selected after a scan. ok mpi@ tb@
2017-02-02Remove global counters from struct ieee80211com which track the number ofStefan Sperling
associated nodes with particular properties: 11b-only ("non-ERP") nodes, nodes requiring long slot time, nodes using WPA, nodes not supporting 11n, nodes currently dozing in powersave state, and nodes with a pending group key update confirmation. These counters weren't properly maintained. There are bugs in the stack where these counters and actual node properties got out of sync. This is exposed by panics which are supposed to help us catch such bugs. But these panics don't provide real clues. Instead of maintaining global counters forcing us to hunt refcounting bugs, count nodes with the property in question on demand, by iterating over all nodes and checking their state. This is cheap since we'll never have more than 100 nodes cached, and none of the cases where we need such information is in a performance critical path. Prevents panics in hostap mode reported by Lauri Tirkkonen on bugs@ last year (https://marc.info/?l=openbsd-bugs&m=147513817930489&w=2) and also encountered by my 11n APs ("panic: bogus non-HT station count 0"). tested by Lauri, tb@, and myself ok mpi@ tb@
2017-01-31In a comment inside ieee80211_up_to_ac(), update a reference sectionStefan Sperling
number from the 802.11-2007 standard to the 802.11-2012 standard.
2017-01-31When telling clients which EDCA parameters to use, copy these parametersStefan Sperling
from the client parameter set, rather than from the AP parameter set. ok mpi@
2017-01-30Enable ieee80211_edca_table, which was under #if 0. This table can be usedStefan Sperling
by drivers to pass default EDCA parameters to firmware instead of passing local hardcoded values. ok millert@
2017-01-28Make mira cope with out-of-range single frame error rate (SFER) values.Stefan Sperling
These are either due to driver bugs or rounding errors in fixed point math but can be dealt with gracefully and don't occur often (only one instance of this problem has been reported in the wild so far). Turn related panics into debug printfs. With 'ifconfig athn0 debug' the kernel now prints notifications about out-of-range SFER values in dmesg. Compile a kernel with 'option MIRA_DEBUG' to get a dump of driver stats in dmesg as well. This change should prevent an undesirable panic reported by Peter Kay, though it does not actually address the root cause of the problem. ok tb@
2017-01-28Introduce ieee80211_mira_probe_done() helper which resets probing state,Stefan Sperling
cancels timeouts, and resets driver stats. Call it when probing has finished instead of manually resetting only probing state. Right now this is only called once but an upcoming change will reuse it.
2017-01-25In amsdu_decap() check the actual length of the data in the remaining mbufStefan Sperling
chain. Else this function will sometimes signal end of AMSDU frame too early. Patch by Imre Vadasz. ok mpi@ phessler@
2017-01-19Enable TKIP as pairwise cipher when ifconfig's wpaprotos option enables WPA1.Stefan Sperling
Without this fix it was impossible to use WPA1 without also making use of the wpaciphers option to enable TKIP. Problem noticed by pirofti@. ok mpi@
2017-01-16Reset block ack state and cancel related timeouts when a HT node disassociates.Stefan Sperling
The existing code (from damien@) already took care of freeing related buffers but because block ack state was not reset we were still trying to use these buffers if the node sent another A-MPDU. This problem only affects 11n hostap. Fixes kernel crash reported by Timo Myyra on bugs@
2017-01-16Prevent wireless frame injection attack described at 33C3 in the talkStefan Sperling
titled "Predicting and Abusing WPA2/802.11 Group Keys" by Mathy Vanhoef. https://media.ccc.de/v/33c3-8195-predicting_and_abusing_wpa2_802_11_group_keys If an attacker knows the WPA group key the attacker could inject a unicast frame by sending a group-encrypted frame to the AP with addresses set as: addr1 (receiver): ff:ff:ff:ff:ff:ff addr2 (source): MAC of attacker addr3 (target): MAC of victim client The AP would forward this frame as unicast, re-encrypted with the pair-wise session key of the victim client. But an AP should not forward such frames. Guessing a WPA group key used by an OpenBSD AP is hard because our random numbers are actually random. So we are not vulnerable to this attack but we are fixing the forwarding path anyway. ok mpi@ tb@
2017-01-12Rename ieee80211_mira_node_destroy() to ieee80211_mira_cancel_timeouts().Stefan Sperling
No functional change. The previous name was chosen at a time when I could not yet anticipate what this function would really end up doing. The new name should make this function's purpose more obvious, especially where it appears at strategic places in driver code.
2017-01-10Make receiving A-MPDUs with an 11n-enabled athn(4) driver work by notStefan Sperling
requiring 11n wireless drivers to provide an ic_ampdu_rx_start() function. The athn(4) driver won't need this function since the hardware receives A-MPDU and sends block ack without setting up anything.
2017-01-09When a HT node leaves or reassociates as a non-HT node,Stefan Sperling
clear HT capabilities stored in its node cache object. A node may switch from 11n mode to 11a/b/g mode. If we don't clear HT capabilities from the cache the node will be mistaken as 11n-capable after reassociation. ok phessler@ mpi@
2017-01-09Stop defining MIRA_DEBUG by default.Stefan Sperling
2017-01-09Show node MAC addresses in mira debug output.Stefan Sperling
2017-01-09Make the net80211 stack send EDCA parameters to the driver in hostap mode.Stefan Sperling
Fixes problems with timing of frame transmissions which caused packet loss. tested by myself and tb@ ok phessler@ mpi@ tb@
2017-01-09When acting as 11n hostap, send Microsoft WME parameters to clients soStefan Sperling
that Linux clients will decide to use 11n mode. ok phessler@
2017-01-09Manage the HT protection setting if acting as hostap with 11n enabled.Stefan Sperling
For now we flip-flop only between non-member protection and non-HT protection. Running a HT network without protection would require monitoring environmental conditions (e.g. foreign beacons) which make HT protection necessary. The ic_update_htprot driver function becomes optional because it won't be needed by all drivers. Only call it if the driver has set a function pointer. ok tb@
2017-01-09The point of ieee80211_node_leave() is to place the node in COLLECT state.Stefan Sperling
Return early and do nothing if the node is already in COLLECT state upon entry to this function.
2017-01-09When acting as hostap, negotiate HT before calling the driver's ic_newassoc()Stefan Sperling
function, not afterwards. Drivers now know whether a joining node supports HT which helps with setting up state such as which Tx rate to use.
2017-01-09Fix ieee80211_add_htop(), which is not yet called in active code paths.Stefan Sperling
It was creating a corrupt beacon element by ommitting one byte. Fix this and fill the element with actual data from the ic_bss node instead of filling it with zeroes, allowing future 11n hostap to announce the current HT protection mode correctly.
2016-12-31When we disable WPA on an interface, wipe all of the WPA parameters,Peter Hessler
including removing the 802.1x configuration from the card. Found while coming home from CCC Congress. OK stsp@
2016-12-26Allow using 11n mode with APs that do not advertise support for all of MCS 0-7.Stefan Sperling
ok phessler@ tb@
2016-12-26When calculating the set of MCS rates below a particular MCS, skip ratesStefan Sperling
which are not supported by both peers, as already done elsewhere. ok phessler@ tb@
2016-12-20Disable TKIP (WPA1) by default.Stefan Sperling
It is time for this legacy of WEP to die (remember WEP?). The 802.11-2012 standard says: The use of TKIP is deprecated. The TKIP algorithm is unsuitable for the purposes of this standard. TKIP has numerous problems. One of which is that TKIP allows a denial of service attack which can be triggered by any client. Report 2 Michael MIC failures to a TKIP AP to trigger "TKIP countermeasures". The AP is now required by the 802.11 standard to lock everyone out for at least 60 seconds. The network will remain unusable for as long as such MIC failure reports are sent twice per minute. TKIP remains available for interoperability purposes, for now. It must be enabled manually with ifconfig(8). Prompted by discussion with Mathy Vanhoef. ok deraadt@ sthen@ reyk@
2016-12-18While copying out channel flags to userspace, omit the HT channel flag ifStefan Sperling
we're not in 11n mode. This will allow tcpdump to show the mode correctly. ok mpi@
2016-12-18Set the maximum TKIP countermeasure timeout to 90 seconds instead of 120.Stefan Sperling
Waiting more time does not buy us anything and makes a denial of service a tiny bit easier. Suggested by Mathy Vanhoef.
2016-12-17Don't crash while sending a TKIP MIC failure report to the AP.Stefan Sperling
Client-side bug found while investigating TKIP countermeasures.