summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_node.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spellingjsg2021-03-101-2/+2
| | | | ok gnezdo@ semarie@ mpi@
* Remove a dead assignment to ni_rsn_state in ieee80211_node_leave_rsn().stsp2020-05-311-3/+1
| | | | Patch by Mikolaj Kucharski
* Purge the ic_bss->ni_savedq mbuf queue when a wireless interface goes down.stsp2020-05-051-2/+6
| | | | | | | | | | | | | | | | | | | | | | Purging this queue prevents a panic which occurs when a WPA2-enabled athn(4) hostap interface is reconfigured while this queue contains frames. In hostap mode, this queue contains group-addressed (broadcast) frames which are buffered for clients sleeping in powersave state. Frames on this queue are transmitted when it is time to send another beacon, at which point in time sleeping clients wake up to receive such frames. The panic message is "key unset for sw crypto", which can be explained as follows: Group keys are cleared when the interface goes down. The beacon Tx interrupt handler gets triggered by hardware when the interface comes back up. This handler attempts to encrypt the queued frames for transmission, resulting in the above panic since the group key has been zeroed out. This panic has been observed with athn(4) by Jan Stary and Ted Patterson, and Ted has confirmed that this patch fixes the problem. ok kettenis@ (with the caveat that it's been a long time since he put our AP-side powersave support into a working state)
* Fix ifconfig "media:" line for 11n wifi interfaces during and after bgscan.stsp2020-04-081-1/+16
| | | | | | | | 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@
* If join is connected to an AP, remove the node from the cache so we properlyphessler2020-01-151-2/+1
| | | | | | reconnect to the AP OK stsp@
* If the new candidate AP found after a background scan has an RSSI levelstsp2019-12-291-4/+6
| | | | | | | | 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
* Stop connecting to available open wifi networks when the interface is put up.stsp2019-11-101-3/+2
| | | | | From now on, this behaviour must be explicitly enabled with ifconfig join "". ok sthen jcs deraadt
* Give access points which fail to AUTH or ASSOC less priority duringstsp2019-11-091-1/+14
| | | | | | | | | | | | 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@
* Clear the unref callback function pointer when cleaning up an ieee80211_node.stsp2019-11-091-1/+2
| | | | ok mpi@
* Make background scans less frequent if we keep choosing the same AP.stsp2019-10-311-3/+7
| | | | | | | | | 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
* Make net80211 expose reasons for association failures to userland and havestsp2019-09-021-36/+69
| | | | | | | | | | | | | | 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@
* Keep ieee80211_node structures cached across scans, rather thanstsp2019-08-271-9/+46
| | | | | | | | | | | | | | | | | | | | | | | 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).
* remove redundant assignment to ic_curmodestsp2019-08-261-3/+1
| | | | | | | | 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@
* Add support for 802.11n Tx aggregation to net80211 and the iwn(4) driver.stsp2019-07-291-6/+90
| | | | | | | | | | | | | | | | | | | 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
* In 11n hostap mode, properly disable HT protection when neededstsp2019-07-231-2/+2
| | | | | by actually overwriting the relevant bits in ni_htop1. ok tedu@ phessler@ kettenis@
* Revised version of 'ifconfig mode' command fix.stsp2019-06-101-11/+6
| | | | | | | | | | 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@
* Revert my "Repair the 'ifconfig mode' command" commit.stsp2019-05-311-2/+3
| | | | | The "recursion in end_scan()" problem is apparently still present in the committed version of the diff (reported by krw@).
* Repair the 'ifconfig mode' command.stsp2019-05-291-3/+2
| | | | | | | | | 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
* Show driver name on net80211 scan debug lines.stsp2019-05-111-2/+2
| | | | ok mpi@
* Removes the KERNEL_LOCK() from bridge(4)'s output fast-path.mpi2019-04-281-5/+5
| | | | | | | | This redefines the ifp <-> bridge relationship. No lock can be currently used across the multiples contexts where the bridge has tentacles to protect a pointer, use an interface index. Tested by various, ok dlg@, visa@
* fix autojoin for WEP network by actually saving the WEP auth keyphessler2019-03-151-2/+5
| | | | discovered while attempting to autojoin WEP networks
* Improve handling of HT protection for 'mode 11n' hostap.stsp2019-03-011-12/+32
| | | | | | | | | | | | | Consider the mere presence of HTCAP IEs as indicator of 11n support, rather than checking advertised Rx MCS. Fixes some devices being misclassified as 11a/g, causing HT protection to be enabled even though it is not needed. Use CTS-to-self frames for HT protection instead of RTS/CTS. These changes make my athn(4) AR9280 hostap perform much better. ok phessler@
* Move 802.11n rateset definitions out of MiRA and make them available tostsp2019-01-231-2/+3
| | | | | | | | net80211 and drivers in general. Add ratesets for 'short guard interval' (SGI) rates, and add SGI support to MiRA. SGI is currently only used by iwm(4), and of course internally by bwfm(4) firmware. Ratesets for 11n 40 MHz channels and 11ac will come later. ok mpi@ phessler@
* add a len field when we delete an essid from the joinlist. this will havephessler2019-01-181-5/+5
| | | | | | us properly match, instead of hoping we got lucky when selecting it. OK stsp@
* let users automatically use join to connect to any open wifi network.phessler2019-01-181-8/+17
| | | | | | if a known network is visible, always prefer that instead. requested by many, OK stsp@
* print more details about the join'd networks we have saved when a user runsphessler2018-11-251-1/+5
| | | | | | ifconfig if joinlist OK stsp@
* fix whitespace in debugging functionphessler2018-11-201-6/+6
|
* The first packet received from each AP in each QoS class would bepatrick2018-11-201-2/+6
| | | | | | | | | | | | dropped as the sequence number matches the initial value of the cached last sequence number (zero). On some APs (notably Android WIFI hotspots) this hits the first packet of the WPA2 4-way handshake. This causes connection delays and in some cases connection to the AP fails completely. Initialize the cached last sequence numbers for received packets to an invalid value instead. From Christian Ehrhardt ok gerhard@ stsp@
* pass around the ess and ni structures we plan to use directly, insteadphessler2018-10-271-18/+15
| | | | | | of rediscovering them (possibly badly). OK stsp@
* clean up accounting of the AUTO_JOIN flag by making sure it is set or clearedphessler2018-10-271-1/+3
| | | | | | based on the state of the joinlist OK stsp@
* don't join to a network where we expect cleartext, and the AP is using cryptophessler2018-10-271-1/+4
| | | | OK stsp@
* fix memory leak in ieee80211_end_scan()mestre2018-09-181-1/+2
| | | | OK phessler@ jsg@
* fix memory leaks in ieee80211_add_ess()jsg2018-09-171-3/+7
| | | | ok stsp@ phessler@
* ues the format string for signed ints, for signed intsphessler2018-09-111-3/+3
| | | | reminded by stsp@
* With the interface debug flag enabled, print a "score" for each AP wephessler2018-09-111-93/+45
| | | | | | | consider during auto-join. This can help users determine why a specific network was chosen. OK stsp@
* fix typo in the length of the essid we want to switch tophessler2018-09-101-2/+2
| | | | found with and OK stsp@
* extract clearing WEP/WPA in ess into helper functionsphessler2018-09-101-29/+29
|
* give set_ess a len variable, so we can correctly match the essid we wantphessler2018-09-101-9/+5
| | | | | | to switch to. pointed out by stsp@
* convert the things we save in 'join' into a single ioctl. mixing relatedphessler2018-09-091-35/+151
| | | | | | | | | settings over multiple calls was risky and racy. Pass essid, wpa, and wep paramaters in a single ioctl and process it atomically. no change for 'nwid' users OK stsp@ benno@
* fix whitespacejsg2018-09-061-2/+2
|
* Make 'ifconfig nwid' override 'ifconfig join'.stsp2018-09-011-1/+15
| | | | | | | | | | | | | | | | | | | | | There was no way to override a decision made by join's network selection algorithm (apart from disabling the feature by clearing the join list). Automatic selection is based on heuristics which cannot always guess correctly so we need to provide an override. One specific problem was that if 'nwid foo' and 'nwid bar' were both visible in the scan and only 'nwid foo' was a member of the join list, then there was no way at all to connect to 'nwid bar'. The wireless stack would keep selecting 'nwid foo' instead. 'ifconfig iwm0 nwid bar' command will now disable automatic network selection and force the use of ESSID 'bar'. Any of these commands will re-enable automatic network selection: ifconfig iwm0 -nwid ifconfig iwm0 nwid '' ifconfig iwm0 join some-network-id ok phessler@ deraadt@
* Update AP selection heuristics for auto-join.stsp2018-08-151-76/+178
| | | | | | | | | | | | We now prefer stronger crypto over weaker crypto over none, prefer 5 GHz band with reasonable RSSI, and use RSSI as a tie-breaker with a slight advantage for 5GHz. Candidate APs are now ranked by a score which is calculated based on these attributes. There is likely room for improvements to make these heuristics work well across many different environments, but it's a start. ok phessler@
* Add support for band-steering access points to net80211.stsp2018-08-131-56/+79
| | | | | | | | | | | | | | | | Some access points have a feature called "band steering" where they will try to push clients from 2 GHz channels to 5 GHz channels. If a client sends probe-requests on both 2 GHz and 5GHz channels, and then attempts to authenticate on a 2 GHz channel, such APs will deny authentication and hope that the client will come back on a 5 GHz channel. So if we fail to AUTH for any reason, and if there is a different AP with the same ESSID that we haven't tried yet, try that AP next. Keep trying until no APs are left, and only then continue scanning. APs with support for this feature were provided by Mischa Peters. ok phessler@ mpi@
* Add comment explaining why we read basic MCS set only from beacon/probereq.stsp2018-08-111-1/+6
| | | | requested by mpi@
* Ignore basic MCS set information found in association responses.stsp2018-08-071-3/+4
| | | | | | | | | | | | | Some APs (Aruba 105) send a bogus basic MCS set in assoc responses which prevents us from enabling 11n support with those APs, while these APs still behave as if were were an 11n client which renders the association unusable. The basic MSC set is already provided in beacons anyway, and the 802.11 2012 standard says the basic MSC set is reserved in frames other than beacons (see Table 8-130). ok mpi@
* Refactor ieee80211_add_ess():stsp2018-08-061-5/+6
| | | | | | | | | | Drop ieee80211_add_ess's nwid parameter. Read nwid and length directly from the ic to make it more obvious where this function is reading from. nwids are binary data with an explicit length, so treat them as such instead of treating them like strings. ok florian phessler
* Do not set nwid over and over again. We just found the ess by comparingflorian2018-08-061-4/+3
| | | | | the nwid. It will not have changed in the meantime. OK stsp
* revert 1.133 and part of 1.131phessler2018-08-031-8/+1
| | | | | | the stack doesn't always fill in the paramaters correctly reported by many
* Don't ask drivers to join a wifi network before an AP has been chosen.stsp2018-07-301-10/+1
| | | | | Should fix a panic with bwfm(4) reported by mlarkin@ ok phessler@
* ieee80211_ess_is_better() returns 0 or 1, comparing > 1 is alwaysflorian2018-07-191-6/+6
| | | | | | | | | | false so we always selected the first wifi available, not the best one. While here shuffle some deck chairs to make it clearer that anything is better than nothing. tweak & OK phessler