summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_node.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* the AP sends their crypto parameters as a mask, so let us still select itphessler2018-07-161-6/+4
| | | | in case we want WPA2 and they have WPA1 still enabled
* don't save or use auto-join when the card is not in station (aka client) modephessler2018-07-161-2/+6
| | | | OK stsp@
* Some more checks before auto-join switches networks.phessler2018-07-131-1/+25
| | | | | | | | Make sure all of the crypto options the AP announces matches what we would configure. While here, don't switch if the user has specified a specific BSSID, and the new AP does not match. OK stsp@
* Introduce 'auto-join' to the wifi 802.11 stack.phessler2018-07-111-1/+345
| | | | | | | | | | | | | | | | | | | | | This allows a system to remember which ESSIDs it wants to connect to, any relevant security configuration, and switch to it when the network we are currently connected to is no longer available. Works when connecting and switching between WPA2/WPA1/WEP/clear encryptions. example hostname.if: join home wpakey password join work wpakey mekmitasdigoat join open-lounge join cafe wpakey cafe2018 join "wepnetwork" nwkey "12345" dhcp inet6 autoconf up OK stsp@ reyk@ and enthusiasm from every hackroom I've been in for the last 3 years
* When starting a background scan, free the nodes table to ensure westsp2018-04-281-5/+5
| | | | | | | | | get an up-to-date view of APs around us. In particular, we need to kick out the AP we are associated to. Otherwise, our current AP might stay cached if it is turned off while we are scanning, and we could end up picking a now non-existent but "good looking" AP over and over. found with and ok phessler@
* Fix the scan loop: We were only looking for an AP once and stoppedstsp2018-04-271-4/+2
| | | | | | scanning if none was found. Accidentally broken in recent ifconfig scan changes by pirofti and me. ok pirofti
* net80211: stub SIOCS80211SCAN, make ifconfig scan instant.pirofti2018-04-261-26/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The following removes the functionality of the SIOCS80211SCAN ioctl. After long discussions with stps@, mpi@, and deraadt@ we decided that this was the correct way of fixing ifconfig scan from blocking the network stack. The kernel will continue scanning in the background and filling the nodes array, but ifconfig scan commands will now basically do just a SIOCG80211ALLNODES and pretty print the array. So the output stays the same but is instant. In fact, when the interface is freshly brought up, if you type fast enough, you can see the array being filled by running multiple ifconfig scans in sequence. The SIOCS80211SCAN ioctl stays for now as wi(4), pgt(4) and malo(4) still need it around. But not for long... Another change that this introduces is the fact that ifconfig scan no longer plays with UP and DOWN. If the interface is down it complains and exits. This is needed in order to maintain the nodes list. Works on iwm(4), iwn(4), urtwn(4), run(4) and athn(4). Tested by mpi@, landry@, florian@, thanks! OK mpi@.
* convert the test if a node support HT (aka, 11n) into an inline function,phessler2018-02-061-3/+3
| | | | | | instead of testing some un-obvious bitfield OK stsp@
* Don't dereference IEEE80211_CHAN_ANYC pointer in ieee80211_node_checkrssi().stsp2017-12-121-1/+4
| | | | Problem reported by Gregoire Jadi on bugs@
* Allow interfaces that aren't SCANNALLBAND drivers to benefit from thephessler2017-12-121-9/+10
| | | | | | strongest received signal. OK stsp@
* Fix the behavior of preferring weaker-but-still-good 5Ghz APs overjcs2017-12-121-26/+29
| | | | | | | | | 2Ghz APs because the 5Ghz band is generally less saturated. The previous implementation was dependent upon the order of walking APs. ok stsp
* Add support for background scanning to net80211 and iwm(4).stsp2017-12-081-42/+218
| | | | | | | | | | The iwm(4) driver will now roam between access points which share an SSID. Use 'ifconfig iwm0 debug' and 'tail -f /var/log/messages' to watch it do so. Tested by several people in various iterations. As usual, let me know if you run into issues. ok phessler deraadt
* When starting a new scan always set the mode to AUTO if the driver scansstsp2017-09-051-2/+3
| | | | | | all bands at once. Fixes a problem where e.g. 5GHz APs were filtered out if we were previously associated to an 11g-only AP. ok mpi@ phessler@
* Add an entry to dmesg if pairwise WPA keys arrive unexpectedly or if WPAstsp2017-08-171-1/+2
| | | | | | | | | | group keys are being reused. OpenBSD wireless clients will now leave a trail of such events in their message log. There has been increased public scrutiny of WPA's security recently, so I am curious to see if anyone is attempting replay attacks in the wild. ok deraadt
* Compile a debug printf in ieee80211_match_bss() by default, previouslystsp2017-08-041-6/+4
| | | | | | | | guarded by the IEEE80211_DEBUG preprocessor flag. This shows one line per detected AP after a scan, and indicates which APs are considered candidates for association. Shorten the output a bit to fit into 80 columns more likely. ok sthen@
* Improve the heuristic which selects 5GHz APs over 2GHz APs.stsp2017-07-191-4/+18
| | | | | | | | | | | | | | | | | | The previous code wasn't quite right: it didn't account for the fact that some drivers don't set ic_max_rssi, and it compared 5GHz APs to a threshold relative to the max RSSI, rather than comparing RSSI on 5GHz relative to RSSI on 2GHz. This heuristic is only used by SCANNALLBAND drivers: iwn(4), iwm(4), wpi(4) In the future the AP selection heuristic should be made more intelligent, e.g. it should take BSS load information in beacons into account. Another open problem is inconsistent representation of RSSI measurement values throughout our drivers and stack. Help is welcome! For now, this hopefully improves AP selection at busy airports. ok sthen@ deraadt@
* Add sizes for free for the RSN IEs. Rewrite ieee80211_save_ie() slightlytb2017-06-041-2/+2
| | | | | | to make it more readable. help, many explanations and ok stsp
* Add a few sizes to free().tb2017-06-031-6/+6
| | | | Input, help & ok stsp
* In 11n hostap mode, dynamically adjust HT protection settings based onstsp2017-03-041-32/+38
| | | | | | 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@
* Fix 11b clients sending bogus ratesets in association requests. The commonstsp2017-02-031-1/+7
| | | | | | 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@
* Remove global counters from struct ieee80211com which track the number ofstsp2017-02-021-37/+94
| | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Reset block ack state and cancel related timeouts when a HT node disassociates.stsp2017-01-161-1/+2
| | | | | | | 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@
* When a HT node leaves or reassociates as a non-HT node,stsp2017-01-091-1/+24
| | | | | | | | | | 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@
* Make the net80211 stack send EDCA parameters to the driver in hostap mode.stsp2017-01-091-1/+18
| | | | | | Fixes problems with timing of frame transmissions which caused packet loss. tested by myself and tb@ ok phessler@ mpi@ tb@
* Manage the HT protection setting if acting as hostap with 11n enabled.stsp2017-01-091-2/+30
| | | | | | | | | | | 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@
* The point of ieee80211_node_leave() is to place the node in COLLECT state.stsp2017-01-091-1/+4
| | | | | Return early and do nothing if the node is already in COLLECT state upon entry to this function.
* When acting as hostap, negotiate HT before calling the driver's ic_newassoc()stsp2017-01-091-5/+5
| | | | | 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.
* Complete our half-done implementation of TKIP countermeasures in hostap mode.stsp2016-12-171-1/+3
| | | | | | | | | | The previous code would disable the AP until next reboot upon MIC failure. Instead, disable the AP for 60 seconds, as required by the 802.11 standard. I randomly added a bit of time (up to 120 seconds total) just because we can. Problem reported by Mathy Vanhoef, thanks! ok deraadt@ random input reyk@
* move from RB macros to the RBT functions.dlg2016-09-151-20/+20
| | | | shaves about 5k off an amd64 GENERIC.MP kernel
* If a wireless device or driver scans all bands at once give 5GHz APsstsp2016-08-171-7/+18
| | | | | a slight priority in cases where good matches exist in either band. ok sthen@
* Add a wireless driver capability flag for devices which scan 2GHz and 5GHzstsp2016-05-211-6/+9
| | | | | bands in a single scan offload request. This will be used by iwm(4) soon. ok kettenis@, earlier version ok phessler@
* In hostap mode, don't re-use association IDs (AIDs) of nodes which arestsp2016-05-181-7/+3
| | | | | | | | | | | | | | | | | | | | | | | still lingering in the node cache. This could cause an AID to be assigned twice, once to a newly associated node and once to a different node in COLLECT cache state (i.e. marked for future eviction from the node cache). Drivers (e.g. rt2860) may use AIDs to keep track of nodes in firmware tables and get confused when AIDs aren't unique across the node cache. The symptom observed with rt2860 were nodes stuck at 1 Mbps Tx rate since the duplicate AID made the driver perform Tx rate (AMRR) accounting on the wrong node object. To find out if a node is associated we now check the node's cache state, rather than comparing the node's AID against zero. An AID is assigned when a node associates and it lasts until the node is eventually purged from the node cache (previously, the AID was made available for re-use when the node was placed in COLLECT state). There is no need to be stingy with AIDs since the number of possible AIDs exceeds the maximum number of nodes in the cache. Problem found by Nathanael Rensen. Fix written by Nathanael and myself. Tested by Nathanael. Comitting now to get this change tested across as many drivers as possible.
* Call if_enqueue() and if_start() instead of dereferencing the ifpmpi2016-04-121-2/+2
| | | | | | | | | | | pointers. These functions have been introduced to abstract some of the MP- safeness^Wmadness and should be use everywhere. Prodded by a comment from jsg@. ok mikeb@, stsp@
* Restore assignment of ic_curmode that was accidentally removed whengerhard2016-03-031-1/+3
| | | | | | | moving the ERP code to post-assoc phase. Fixes iwi(4) fatal firmware errors. ok stsp@, sobrado@
* Honour ERP protection on 2 GHz channels in 11n mode, as done for 11g.stsp2016-01-251-3/+7
| | | | ok millert@
* Don't try to interpret htprot data if the last beacon didn't contain such data.stsp2016-01-251-3/+5
| | | | ok mpi@ millert@
* Make the A-MPDU reordering buffer more resilient against APs which dropstsp2016-01-071-3/+5
| | | | | | | | | | | | | some subframes or let the sequence number jump up by more than 1 (hard to tell which it is). We decrease the BA inactivity timeout for quicker recovery from stalled BA sessions, and add a new timeout which keeps track of gaps in the subframe sequence number space due to dropped frames. Gaps expire after 500 msec, the same value FreeBSD uses for their implementation of this workaround. And Linux uses this trick, too. This should fix network stalls some people have been seeing in 11n mode. ok deraadt@
* Remove the IEEE80211_NO_HT macro. Reduces ifdef spaghetti, enables 11n modestsp2016-01-051-23/+1
| | | | | in bsd.rd, and might uncover some bugs. Suggested by tedu@ and deraadt@. ok sthen@ jasper@ deraadt@
* While configuring ERP we need to know if we're in 11a or 11g mode so onlystsp2016-01-041-9/+1
| | | | | configure ERP once we are sure about our operation mode against the AP. ok sthen jasper kettenis deraadt mpi
* unnoccupied->unoccupiedsthen2015-12-181-2/+2
|
* Finish support for receiving 11n A-MPDUs.stsp2015-12-121-1/+36
| | | | | | | | | | | | | | The initial implementation was added by damien@ years ago. Summary of the changes made in this commit: - In ieee80211_input(), process A-MPDUs before duplicate detection. - Don't forget to set ba->ba_ni in ieee80211_recv_addba_req() so we don't crash in ieee80211_rx_ba_timeout(). - In ieee80211_recv_addba_req(), tweak the logic to deny BlockAck requests if the driver has no callback for doing so. - Implement ieee80211_ba_del() which cleans up BlockAck state. - Increase the minimum and maximum lifetime for BlockAck agrements. ok mpi@
* No need to include <net/if_arp.h>mpi2015-11-241-2/+1
| | | | | | | | | This header is only needed because <netinet/if_ether.h> declares a structure that needs it. But it turns out that <net/if.h> already includes it as workaround. A proper solution would be to stop declarting "struct ether_arp" there. But no driver should need this header.
* Parse 11n HT capabilities and operational info from association responsestsp2015-11-151-1/+2
| | | | | | | frames, negotiate HT with the AP, and move the interface into or out of 11n mode accordingly. If running as AP negotiate HT with nodes joining the BSS. ok deraadt mpi kettenis guenther
* Extend struct ieee80211_node with fields for 11n STA HT capabilities andstsp2015-11-151-1/+56
| | | | | | | | | | | | HT operational information sent by 11n APs. These fields reflect the structure of elements in management frames so that IEEE80211_HTCAP* and IEEE80211_HTOP* macros designed to operate on frame elements can be used directly to read or set the fields. Populate nodes with HT information received in probe responses, probe requests, and association requests. ok deraadt mpi phessler kettenis guenther
* replace the ifqueues in net80211 with mbuf_queues.dlg2015-11-041-13/+8
| | | | | | | | the specific queues are ic_mgtq, ic_pwrsaveq, and ni_savedq. rtw had its own queue for beacons. tested by mpi@ and jmc@ ok mpi@
* m_freem() can handle NULL, do not check for this condition beforehands.deraadt2015-07-151-3/+2
| | | | ok stsp mpi
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-6/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* unifdef some more INET. v4 4life.tedu2014-12-231-3/+1
|
* move arc4random prototype to systm.h. more appropriate for most codetedu2014-11-181-3/+1
| | | | to include that than rdnvar.h. ok deraadt dlg
* remove uneeded proc.h includesjsg2014-09-141-2/+1
| | | | ok mpi@ kspillner@