summaryrefslogtreecommitdiff
path: root/sys/net80211
AgeCommit message (Collapse)Author
2020-04-11Update MiRA probing interval of probed rates which are worse than theStefan Sperling
current best rate, not worse than the rate currently being probed. This seems to be a more accurate interpretation of the MiRA paper. The paper says the interval for a rate needs to be updated if the rate's goodput is worse than that of the "current transmission rate" (see the "Adaptive probing interval" section). Our implementation interpreted "current transmission rate" as "rate being probed right now" and adjusted the interval of the previously probed rate. However, the context of this section of the paper suggests that "current transmissions rate" intends to refer to the currently selected best rate for our non-probing transmissions. testing and ok tb@ jmatthew@
2020-04-08Fix ifconfig "media:" line for 11n wifi interfaces during and after bgscan.Stefan Sperling
Media was displayed as e.g. "autoselect (OFDM6)" even though 11n was active because the current media mode is changed to AUTO for background scanning and was never switched back to 11N. ok mpi@ pirofti@
2020-03-30Don't let MiRA trigger event-based probing if the current measurementStefan Sperling
equals the average measurement, i.e. if the standard deviation is zero. Change comparisons of current measurement to the average measurement from >= to > in the "channel becomes good" check, and from <= to < in the "channel becomes bad" check. The paper's equations are written with <= and >= and thus so was our implementation. But checking for equality makes no sense in the context of event-triggered probing: The intention is to react to changes in channel quality, which occur for instance when a laptop moves around or when RF noise comes and goes. When the current measurement and the average measurement are equal, this means channel quality has not changed at all and starting to probe for a new rate is not necessary. We should probably even add a margin to avoid triggering probing based on small fluctuations, but this can be done later. ok tb@
2020-03-29Compute MiRA's moving average and standard deviation after computing theStefan Sperling
current measurement, not before. The MiRA paper mentions these calculations in the order we implemented them. But the moving average and standard deviation depend on the value of the goodput measurement, not the other way around. ok tb@
2020-03-11Make sure hdrlen is initialized.tobhe
ok stsp@
2020-03-06Properly wrap 802.11 frame sequence numbers when incrementing them.Stefan Sperling
ok tb@ tobhe@ mpi@
2020-03-05Fix MiRA probing shortcut comparing measured throughput against theStefan Sperling
theoretical throughput of another MCS. Packet loss indicates that this MCS isn't necessarily going to be the best choice, so do not allow lossy throughput measurements to win unchallenged. ok tb@
2020-03-05Fix a MiRa probing short-cut comparing current to previous measurements.Stefan Sperling
When checking if a previously probed MCS had a better measurement, do not allow the current MCS being probed to win right away. Otherwise we may end up sticking to our current Tx rate even if further probing would yield a better result. ok tb@
2020-03-05Cancel MiRA probing timeouts if a channel quality change triggers probing.Stefan Sperling
Avoids unnecessary re-probing in case a timeout had been scheduled already. tweak + ok tb@
2020-03-05fix build without MIRA_AGGRESSIVE_DOWNWARDS_PROBINGStefan Sperling
ok tb@
2020-03-05MiRA needs to add tx time overhead for ACK only for single-frame transmissions.Stefan Sperling
Resolves XXX comments regarding block-ack support. with simplification tweak from + ok tb@
2020-03-03Fix dead link to the MiRA paper and add DOI link to the published version.Theo Buehler
ok stsp
2020-03-03Fix MiRA's sub-frame error rate computation.Stefan Sperling
When describing the equation for computing a sub-frame error rate (SFER) the MiRA paper uses "hardware retries" to refer to the number of times a frame, which eventually failed entirely, was retransmitted (a situation our drivers would call "txfail"), and "nBad" to refer to frames which were "received with errors" (and this is what our drivers would call "retries"). Because of my misunderstanding of the wording used in the paper our SFER equation ended up with the "retries" and "nBad" variables swapped. Swapping them back produces more meaningful results with reasonable frame loss percentages based on the counters passed in by drivers. ok tb@
2020-03-03Do not send any QoS data frames unless Tx aggregation has been negotiated.Stefan Sperling
Actual QoS support could be added to net80211 in the future, but for now we only use QoS frames for A-MPDU aggregation. Without QoS support, sending non-aggregated QoS frames does not actually buy us anything and makes it harder to look at packet captures and tell whether frames sent by an OpenBSD machine were in fact aggregated or not. Tested on iwn(4) by jmc@, paco@, bket@, paco@, and Lauri Tirkkonen
2020-02-18Fix an mbuf corruption issue which occurs in net80211 hostap mode.Stefan Sperling
When sizing a memory allocation for a probe response frame, the AP used the SSID length stored in the node structure which represents the client, but used the actual length of the SSID when copying it into the frame. If the actual length is sufficiently large this will result in corruption of an adjacent mbuf on the free list since m->m_next will be overwritten with data written to the tail of the probe response frame. Bad things happen later on when the adjacent mbuf is used. Sometimes the corruption is detected by mbufpl's use-after-free checking, at other times we end up crashing somewhere in the network stack. To prevent such a mistake from occuring again I am removing the 'ni' argument from ieee80211_get_probe_resp() altogether. It is not needed. A quick workaround is to configure a short SSID. Debugged with help from claudio, kettenis, and dlg. ok claudio
2020-01-15If join is connected to an AP, remove the node from the cache so we properlyPeter Hessler
reconnect to the AP OK stsp@
2020-01-13When we change attributes for a join essid, we should apply the changePeter Hessler
immediately instead of waiting to (randomly) switch away and switch back. Found by martijn@ OK stsp@
2019-12-29If the new candidate AP found after a background scan has an RSSI levelStefan Sperling
that will also trigger background scans, remain with the current AP. Avoids ping-pong in environments where APs are tuned for low transmit range, such as 36c3. ok phessler benno
2019-12-29increase net80211's node cache size; now we can see all APs at 36c3Stefan Sperling
ok phessler benno
2019-12-27Don't start background scans before WPA handshake has completed.Stefan Sperling
ok phessler
2019-12-20Ignore new Rx block ack agreements until the WPA handshake is done.Stefan Sperling
Some peers will eagerly try to negotiate block ack (asking us to reserve buffer space) before they are done authenticating themselves. No thanks. Just let them try again later. ok mpi@
2019-12-20Have net80211 actually update the Rx block ack sequence number window,Stefan Sperling
as well as pulling frames off the Rx block ack reordering queue, when an incoming frame above the current seqnum window forces us to slide the window forward, potentially losing frames within the old window. Leaving the seqnum window out of sync with the queue would cause needlessly long stalls in traffic until the window moved again for some other reason. Problem observed on lossy wifi whenever netstat -W indicated an increasing "input block ack window slides" counter. With this fix, stalled frames can be observed only for a relatively short amount of time whenever one or more frames in the current window are lost. ok mpi@
2019-12-18Re-enable firmware-based Tx retries at lower rates for iwm(4).Stefan Sperling
Firmware-based Tx retries were disabled when it was found that MiRA makes better choices while probing with a constant Tx retry rate. Before that change, high Tx rates looked better than they actually were. The change resulted in less retries and thus higher throughput because a lower, but actually working, initial Tx rate eventually became the preferred choice. However, disallowing retries at lower rates also resulted in increased amounts of observable packet loss, especially while the connection to the AP was still fresh and bad Tx rates had not been discovered yet. To get the best of both worlds, use a constant Tx rate for retries while MiRA is probing and otherwise allow firmware fallback to lower rates. tested by Tracey Emery, pamela, jasper, and myself, on 7265/8265/9260
2019-11-15Whitespace removal, no code change.Mike Larkin
2019-11-11Prevent a NULL deref in ieee80211_node2req() which could be triggeredStefan Sperling
by an ioctl if the driver had not yet initialized the channel map. Crash reported by nayden@ ok sthen@
2019-11-10Stop connecting to available open wifi networks when the interface is put up.Stefan Sperling
From now on, this behaviour must be explicitly enabled with ifconfig join "". ok sthen jcs deraadt
2019-11-09Give access points which fail to AUTH or ASSOC less priority duringStefan Sperling
the next selection of networks from the join list. Prevents endless attempts to connect to an AP which is out of reach but still somehow manages to get a beacon or two across to us during scan. Tested with wifi networks at the University of Bucharest. Makes switching wifi networks possible after walking to a different room without having to down/up the interface or suspend/resume. ok phessler@
2019-11-09Trigger a background scan when root runs the 'ifconfig scan' command.Stefan Sperling
This will update the list of cached APs for future invocations of the 'scan' command, and will force a search for a better AP to roam to. ok sthen@ phessler@
2019-11-09Clear the unref callback function pointer when cleaning up an ieee80211_node.Stefan Sperling
ok mpi@
2019-11-06Raise net80211's "beacon miss" threshold to avoid frequent re-connectsStefan Sperling
to APs that are relatively far away and suffer some packet loss. The former threshold was 7 beacons (about 700 ms). This raises the threshold to 30 beacons (about 3 seconds). Should still be good enough for detecting APs that have disappeared, and makes wifi networks provided by the University of Bucharest more reliable in the p2k19 hackroom. While here, make 'ifconfig iwm0/iwn0 debug' print an obvious message when we believe that the AP has disappeared. Problem reported and fix tested by landry@ / pirofti@ ok mpi@ sthen@
2019-10-31Make background scans less frequent if we keep choosing the same AP.Stefan Sperling
This helps a bit in situations where a single AP is used and background scans are causing packet loss, as seen with Jesper Wellin's Broadcom-based AP and my Android phone in hotspot mode. This is not a proper fix but our background scan frequency against a single AP was much higher than needed anyway. Tested by jan, job, benno, Tracey Emery, Jesper Wallin
2019-10-11Probe responses are generally only seen after probe requests,Patrick Wildt
which we only send if an SSID is already configured. Thus a scan only creates beacons. Especially on bwfm(4) only beacons frames are faked, there are no probe responses. When a node first is created, ni_rssi is 0, which is always smaller than rxi_rssi, and it wil never be set for nodes on 5 GHz. Thus we should always set ni_rssi if it is 0. Tested by jan@ tobhe@ ok stsp@ deraadt@
2019-10-06Fix net80211's accounting of discarded input control frames.Stefan Sperling
PS-poll and BA-req frames are in fact being processed. Do not count such frames as discarded control frames. OK phessler kn mpi
2019-09-25Update acces point channel in node list when receiving packets from sametobhe
AP on a new channel. Not doing so leads to a disconnect because AP messages on the new channel are ignored.
2019-09-12Make wireless drivers call if_input() only once per interrupt.Stefan Sperling
This reduces drops caused by the ifq pressure drop mechanism and hence increases throughput. Such drops are visible with e.g. 'netstat -dnI iwm0'. Not all affected drivers have been tested yet but these changes are largely mechanical and should be safe. As usual, please report any regressions. With help from dlg@ and mpi@ Problem found by robert@ Tested by robert, jmc, Tracey Emer, Matthias Schmidt, florian, Björn Ketelaars ok mpi@
2019-09-02Make net80211 expose reasons for association failures to userland and haveStefan Sperling
ifconfig display them in 'scan' output and on the ieee80211 status line if the failure is applicable to an already selected AP (e.g. wrong WPA key). This will hopefully reduce the amount of help requests for what often turn out to be trivial misconfiguration issues that were previously hard to diagnose without debug mode. ifconfig must be recompiled with the new ieee80211_ioctl.h to stay in sync with the kernel. A full 'make build' will do the right thing! Very helpful input by mpi@ and deraadt@
2019-09-02Reset the current wireless PHY mode to 'auto' when a scan begins if weStefan Sperling
are in media autoselect mode. The interface might have been switched to a fixed PHY mode during association and keeping it fixed will mislead AP selection after roaming failure. Problem found and diagnosed at CCC camp 2019 Tested by myself, fkr@, chris@
2019-08-29Always parse RSN/WPA IEs if the driver announces support for RSN.Stefan Sperling
Prevents WPA APs from appearing as non-WPA APs to the AP selection logic. The decision whether or not to parse the IE was made as a side-effect of a check for the highest mutually supported version of WPA. We can safely assume that all our drivers support WPA versions <= 2 and parse the IE regardless of whether WPA is currently active or not. ok mpi@
2019-08-27Keep ieee80211_node structures cached across scans, rather thanStefan Sperling
wiping the entire cache every time a scan is triggered. This has benefits for userland programs trying to look at scan results, and for drivers which don't get a full view from hardware on every scan. Nodes will still be evicted from the cache in one of several ways: Add a new way of timing out inactive nodes which don't send a beacon within 10 scan iterations, for client mode only. This should get rid of stale APs if we're scanning for some time in a changing environment. If we fail to associate a few times, the corresponding node is removed. If net80211 transitions back to INIT state (e.g. because of a user-initiated configuration change) all nodes are removed. When a background scan starts all nodes will be removed. This could be revisited later but has been intentionally left as-is for now. Tested by myself, jmc@, benno@, procter@ on iwm(4), athn(4) and ral(4).
2019-08-26remove redundant assignment to ic_curmodeStefan Sperling
This assignment to ic_curmode is redundant because it already occurs inside ieee80211_setmode(), and channel information in selbs and ni is equivalent after node_copy(). ok mpi@ kevlo@
2019-08-16check that software de/encrypt is possible: under hardwareRichard Procter
offload, it needn't be. the stack must otherwise rely on every offloading driver correctly handling all frames governed by a given key. ok stsp@
2019-07-29Add support for 802.11n Tx aggregation to net80211 and the iwn(4) driver.Stefan Sperling
In particular, add Tx block ack session management to net80211, with enough funcionality to support Tx aggregation on devices which perform A-MPDU subframe scheduling in firmware. Make use of the iwn(4) firmware Tx scheduler to build A-MPDUs. net80211's QoS support code is now enabled and used by Tx aggregation. A-MSDU frames inside A-MPDUs have been tested and work in principle. For now, this feature is disabled because unfair TCP connection sharing was observed during testing, where bursts of TCP Ack frames for a single tcpbench(1) connection arriving in A-MSDUs made other TCP connections stall. Switch off support for A-MSDUs inside A-MPDUs on the Rx side as well. Tested on iwn chipsets 1000, 4965, 5100, 5300, 2200, 6200, 6205, 6300 (committed version of tested diff has all debug printfs removed) tests/ok benno kmos mlarkin kevlo
2019-07-23In 11n hostap mode, properly disable HT protection when neededStefan Sperling
by actually overwriting the relevant bits in ni_htop1. ok tedu@ phessler@ kettenis@
2019-06-18Stop probing a Tx rate if transmission failure or too many retries occur.Stefan Sperling
Fixes stalling TCP connections on wifi in some situations. testing jmatthew@, jmc@, Bruno Flueckiger, Micah Muer, Matthias Schmidt
2019-06-10Revised version of 'ifconfig mode' command fix.Stefan Sperling
The 'mode' command is supposed to force a wireless interface into 11a/b/g/n media mode. This stopped working some time ago, probably during my work on background scanning. Problem spotted by mlarkin@ who noticed that interfaces were using 11g mode while forced to 11b mode. ok phessler, jmatthew (earlier version) relentless testing by krw@
2019-05-31Revert my "Repair the 'ifconfig mode' command" commit.Stefan Sperling
The "recursion in end_scan()" problem is apparently still present in the committed version of the diff (reported by krw@).
2019-05-29Repair the 'ifconfig mode' command.Stefan Sperling
The 'mode' command is supposed to force a wireless interface into 11a/b/g/n media mode. This stopped working some time ago, probably during my work on background scanning. Problem spotted by mlarkin@ who noticed that interfaces were using 11g mode while forced to 11b mode. ok phessler, jmatthew
2019-05-21Fix out-of-bounds array access in ieee80211_setbasicrates(); CID 1479607Stefan Sperling
ok kettenis@
2019-05-12Fix 'ifconfig nwflags; These flags ended up overlapping with other flagsStefan Sperling
in ieee80211com's ic_flags because we haven't been paying attention to them (they're not in the same place in the code and hence easy to miss). Move them to a dedicated variable to avoid this problem in the future. Add a new 'stayauth' nwflag which can be set to let net80211 ignore deauth frames. This can be useful when deauth frames are being persistently spoofed by an attacker. Idea from beck@ ok beck@ phessler@
2019-05-11Show driver name on net80211 scan debug lines.Stefan Sperling
ok mpi@