summaryrefslogtreecommitdiffstats
path: root/sys/net80211
Commit message (Collapse)AuthorAgeFilesLines
* MFS r304715:bdrewery2016-08-241-0/+2
| | | | | | | | MFC r304322: [net80211] correctly lock the ifp before accessing the lladdr. Approved by: re (gjb)
* [net80211] teach AMRR to log the initial MCS rate as "MCS X"adrian2016-07-011-2/+11
| | | | | | | Otheriwse it logs it as the rate value, which is 0x80 (MCS flag) + MCS, which isn't that helpful. Approved by: re (gjb)
* net80211: fix LOR/deadlock in ieee80211_ff_node_cleanup().avos2016-06-295-56/+69
| | | | | | | | | | | | | | | | | | | | | Add new lock for stageq (part of ieee80211_superg structure) and ni_tx_superg (part of ieee80211_node structure); drop com_lock protection where it is used to protect them. While here, drop duplicate OPACKETS counter incrementation. ni_tx_ampdu is not protected with it (however, it is also used without locking in other places; probably, it requires some other solution to be thread-safe). Tested with RTL8188CUS (AP) and RTL8188EU (STA). NOTE: Since this change breaks KBI, all wireless drivers need to be recompiled. Reviewed by: adrian Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D6958
* [net80211] re-revert the ibss "is this local to the bss" patch.adrian2016-06-251-1/+4
| | | | | | | | | | | | | | | | avos@ pointed out to me that this broke IBSS merging because the rest of the input path no longer was called for non-IBSS frames. I committed a change to not input non-IBSS frames, which stopped nodes being created for BSSes that weren't ours. Unfortunately thta stopped the input path for non-IBSS frames in general, so the management input path didn't work. So, I'll revert this until I come up with a better solution. (Hopefully before 11.) Reviewed by: avos Approved by: re (gjb)
* [net80211] remove node scan lock / generation number + fix few LORsadrian2016-06-195-184/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop scan generation number and node table scan lock - the only place where ni_scangen is checked is in ieee80211_timeout_stations() (and it is used to prevent duplicate checking of the same node); node scan lock protects only this variable + node table scan generation number. This will fix (at least) next LOR (hostap mode): lock order reversal: 1st 0xc175f84c urtwm0_scan_loc (urtwm0_scan_loc) @ /usr/src/sys/modules/wlan/../../net80211/ieee80211_node.c:2019 2nd 0xc175e018 urtwm0_com_lock (urtwm0_com_lock) @ /usr/src/sys/modules/wlan/../../net80211/ieee80211_node.c:2693 stack backtrace: #0 0xa070d1c5 at witness_debugger+0x75 #1 0xa070d0f6 at witness_checkorder+0xd46 #2 0xa0694cce at __mtx_lock_flags+0x9e #3 0xb03ad9ef at ieee80211_node_leave+0x12f #4 0xb03afd13 at ieee80211_timeout_stations+0x483 #5 0xb03aa1c2 at ieee80211_node_timeout+0x42 #6 0xa06c6fa1 at softclock_call_cc+0x1e1 #7 0xa06c7518 at softclock+0xc8 #8 0xa06789ae at intr_event_execute_handlers+0x8e #9 0xa0678fa0 at ithread_loop+0x90 #10 0xa0675fbe at fork_exit+0x7e #11 0xa08af910 at fork_trampoline+0x8 In addition to the above: * switch to ieee80211_iterate_nodes(); * do not assert that node table lock is held, while calling node_age(); that's not really needed (there are no resources, which can be protected by this lock) + this fixes LOR/deadlock between ieee80211_timeout_stations() and ieee80211_set_tim() (easy to reproduce in HOSTAP mode while sending something to an STA with enabled power management). Tested: * (avos) urtwn0, hostap mode * (adrian) AR9380, STA mode * (adrian) AR9380, AR9331, AR9580, hostap mode Notes: * This changes the net80211 internals, so you have to recompile all of it and the wifi drivers. Submitted by: avos Approved by: re (delphij) Differential Revision: https://reviews.freebsd.org/D6833
* net80211: discard an injected frame if it is smaller than header length.avos2016-06-091-2/+2
| | | | | | | | Do not try to pass such frames; a correct frame cannot be smaller than (the corresponding) header size. (for wpi(4) an additional check was added in r289012). PR: 144987
* net80211: fix duplicate packet counter incrementation.avos2016-06-092-3/+2
| | | | | | | | Remove 'if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);' from raw xmit and apbridge path; it will be incremented by ieee80211_tx_complete() after packet transmission. Noticed by: Imre Vadasz <imre@vdsz.com>
* net80211: replace m_getcl/m_gethdr pair with m_get2 in ieee80211_fragment()avos2016-05-281-10/+2
| | | | | | - Switch to m_get2() for mbuf allocation instead of manual mbuf size determination. - Reuse MIN() macro for mbuf size selection.
* net80211: fix use-after-free in frame defragmentation procedure.avos2016-05-281-9/+10
| | | | | | | | | | - Assign frame sequence/fragment number before frame concatenation; otherwise, frame header pointer (wh) will be invalid. - Move this code block upper and eliminate duplicate 'lwh = mtod()' assignment. Tested with wpi(4) (transmitter) (STA mode) and urtwn(4) (receiver) (HOSTAP mode).
* ifconfig: set by default FCC regulatory domain for wireless interfaces.avos2016-05-261-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change default regulatory domain from DEBUG (no limitations; exposes all device channels) to FCC; as a result, newly created wireless interface with default settings will have less chances to violate country-specific regulations. This change will not affect drivers with pre-initialized regdomain structure (currentry ath(4) and mwl(4)); in that case, the default channel list must correspond to the default regdomain / country setting. You can switch to another regdomain / country via corresponding ifconfig(8) options; the driver must implement ic_getradiocaps() method to restore full channel list. Full country / regdomain list may be obtained via 'ifconfig <iface> list countries' command. Example: change country to Germany: ifconfig wlan0 down # all wlans on the device must be down ifconfig wlan0 country DE ifconfig wlan0 up # wpa_supplicant(8), dhclient(8) etc At the creation time: ifconfig wlan0 create wlandev wpi0 country DE To make changes permanent add the following line to the rc.conf(5): create_args_wlan0="country DE" Tested with - Intel 3945BG (wpi(4)). - WUSB54GC (rum(4)). Reviewed by: adrian Relnotes: yes Differential Revision: https://reviews.freebsd.org/D6228
* net80211: send RTM_IEEE80211_SCAN event when scan was cancelled.avos2016-05-211-3/+3
| | | | | | | | wpa_supplicant(8) expects to see 'scan complete' event after every scan command; in case, when event is not sent it will hang for indefinite time. PR: 209198
* net80211: restore interface state check for IEEE80211_IOC_SCAN_REQ ioctl.avos2016-05-191-0/+5
| | | | | | | | | Do not try to start a scan when interface is not running. How-to-reproduce: 1) ifconfig wlan0 create wlandev urtwn0 2) wlandebug -i wlan0 state 3) ifconfig wlan0 scan
* net80211: fix more compiler warnings.avos2016-05-1912-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ieee80211.c: add_chanlist(): 'error' variable will be uninitialized if no channels were passed; return '0' instead. ieee80211_action.c: ieee80211_send_action_register(): drop 'break' after 'return'. ieee80211_crypto_none.c: none_encap(): 'keyid' is not used in non-debug builds; hide it behind IEEE80211_DEBUG ifdef. ieee80211_freebsd.c: Staticize global 'ieee80211_debug' variable (used only in this file). ieee80211_hostap.c: Fix a comment (associatio -> association). ieee80211_ht.c: ieee80211_setup_htrates(): initialize 'maxunequalmcs' to 0 to mute compiler warning. ieee80211_hwmp.c: hwmp_recv_preq(): copy 'prep' between conditional blocks to fix -Wshadow warning. ieee80211_mesh.c: mesh_newstate(): remove duplicate 'ni' definition. mesh_recv_group_data(): fix -Wempty-body warning in non-debug builds. ieee80211_phy.c: ieee80211_compute_duration(): remove 'break' after panic() call. ieee80211_scan_sta.c: Hide some TDMA-specific macros under IEEE80211_SUPPORT_TDMA ifdef adhoc_pick_bss(): remove 'ic' pointer redefinition. ieee80211_sta.c: sta_beacon_miss(): remove 'ic' pointer redefinition. ieee80211_superg.c: superg_ioctl_set80211(): drop unreachable return. Tested with clang 3.8.0, gcc 4.6.4 and gcc 5.3.0.
* net80211: unbreak 'show all vaps(/a)' ddb commandavos2016-05-173-20/+31
| | | | | | | | | Replace ifnet list lookup (which is broken since r287197, because IFT_IEEE80211 type is not used anymore) with iteration on ieee80211com list. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D6419
* Revert parts of r299575 in order to make more MIPS kernels buildbz2016-05-141-0/+6
| | | | | | | again hopefully. Rather than blindly removing a supposedly unused variable as reported by the Clang Static Analyzer, inspect the code and hide them with proper #ifdefs as they are used in certain conditional parts of the code.
* net80211: drop some unused variables / local macrosavos2016-05-1210-74/+5
| | | | | | | Most of them left after some commits (r178354, r191544, r287197 etc.); some were never used. Found by: Clang Static Analyzer
* net80211: restore 'iflladdr_event' event handler.avos2016-05-061-0/+19
| | | | | | Now 'ether' argument to ifconfig can be used as an alias to 'wlanaddr'. PR: 208933
* net80211: do not hardcode size of ic_modecaps field.avos2016-05-041-1/+2
|
* [net80211] add extra debugging around negotiated A-MPDU parameters.adrian2016-05-041-0/+8
|
* sys/net*: minor spelling fixes.pfg2016-05-0312-21/+21
| | | | No functional change.
* net80211: fix MAC address change via SIOCSIFLLADDR ioctl.avos2016-05-021-1/+11
| | | | | | | Recheck MAC address on SIOCSIFFLAGS; as a result, 'ifconfig wlan0 ether <addr>' can be used after interface startup. PR: 208933
* net80211: calculate IEEE80211_MODE_BYTES / IEEE80211_CHAN_BYTESavos2016-05-012-3/+3
| | | | | | instead of hardcoding it. Suggested by: adrian
* net80211 + drivers: hide size of 'bands' array behind a macro.avos2016-04-291-0/+1
| | | | | Auto-replace 'howmany(IEEE80211_MODE_MAX, 8)' with 'IEEE80211_MODE_BYTES'. No functional changes.
* net80211: provide a set of ieee80211_add_channel*() functionsavos2016-04-293-92/+292
| | | | | | | | | | | | | | | | | | | This change adds few methods for net80211 channel table setup: - ieee80211_add_channel() - ieee80211_add_channel_ht40() (primarily for drivers, that parse EEPROM to get channel list - they will allow to hide implementation details). - ieee80211_add_channel_list_2ghz() - ieee80211_add_channel_list_5ghz() (mostly as a replacement for ieee80211_init_channels() - they will allow to specify non-default channel list; may be used in ic_getradiocaps()). Tested with wpi(4) (add_channel) and rum(4) (add_channel_list_2ghz). Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D6124
* [net80211] fix indenting.adrian2016-04-281-2/+2
| | | | Sponsored by: Eva Automation, Inc.
* [net80211] handle action frames in adhoc mode from the node that created the ↵adrian2016-04-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | BSS. We don't have a separate bss node; instead we dup the first node we saw and turn that into the BSS node. This means that action frames from that node would be rejected. So, check that the node is the bss node /and/ the MAC doesn't match ni_macaddr. That's the "right" way for now to verify it's an unknown node. This fixes handling action frames in adhoc mode, which includes negotiating 11n aggregation via ADDBA/DELBA. This by itself isn't enough to correctly create 11n adhoc networks; but it is required for aggregation to be negotiated. Tested: * AR9380, 11n adhoc mode * broadcom 11ac adhoc (vendor platform) Sponsored by: Eva Automation, Inc.
* [net80211] add the STBC ioctl support.adrian2016-04-261-0/+32
| | | | This adds configurable STBC TX and RX support.
* [net80211] add STBC capability flags to iv_flags_ht.adrian2016-04-261-0/+12
| | | | | | | | | | | | | This is in preparation for exposing configuring STBC flags up to ifconfig so STBC TX/RX can be configured at runtime. * Set the FHT_STBC flags for TX/RX if the HT capabilitiex exist * Clear the RX STBC HT capability flag when creating a HTCAP IE, so we only announce it if it's configured in the FHT flags. Tested: * AR9331 (carambola2), AP/STA modes
* [net80211] add an ioctl for LDPC configuration.adrian2016-04-261-0/+1
|
* sys: use our roundup2/rounddown2() macros when param.h is available.pfg2016-04-211-1/+1
| | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted.
* net80211: refresh comments for ieee80211_scan_next() andavos2016-04-212-10/+14
| | | | | | | | | ieee80211_scan_done(). Refresh comments that reference scan_next() method (does not exist since r191746) + fix spelling of 'current'. Differential Revision: https://reviews.freebsd.org/D5137
* net80211: enable promiscuous mode state change for non-monitor/ahdemo modesavos2016-04-212-14/+20
| | | | | | | | | | | | | | | - Allow to enable/disable promiscuous mode when: * interface is not a member of bridge, or; * request was issued by user (ifconfig wlan0 promisc), or; * interface is in MONITOR or AHDEMO mode. - Drop local workarounds in mwl(4) and malo(4). Tested with: - Intel 3945BG, STA mode; - RTL8188CUS, MONITOR mode; Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D5472
* net80211: hide subtype mask & shift in function call.avos2016-04-2012-38/+33
| | | | | | | | | | Hide subtype mask/shift (which is used for index calculation in ieee80211_mgt_subtype_name[] array) in function call. Tested with RTL8188CUS, STA mode. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D5369
* net80211: provide descriptions for reason codesavos2016-04-208-18/+163
| | | | | | | | | Add text description for deauth/disassoc/etc reason codes in addition to 'reason: <number>' string. Reviewed by: adrian Obtained from: IEEE Std 802.11-2012, 8.4.1.7 "Reason Code field" Differential Revision: https://reviews.freebsd.org/D5367
* net80211 (trivial, noop): remove duplicate check from hostap_recv_mgmt()avos2016-04-201-5/+6
| | | | Differential Revision: https://reviews.freebsd.org/D5483
* net80211: replace internal LE_READ_*/LE_WRITE_* macro with systemavos2016-04-2010-102/+66
| | | | | | | | | | | | | | | | | le*dec / le*enc functions. Replace net80211 specific macros with system-wide bytestream encoding/decoding functions: - LE_READ_2 -> le16dec - LE_READ_4 -> le32dec - LE_WRITE_2 -> le16enc - LE_WRITE_4 -> le32enc + drop ieee80211_input.h include, where it was included for these operations only. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D6030
* net80211: do not reschedule scan_curchan_task() if the scan was canceled.avos2016-04-191-1/+4
| | | | | | This should fix possible use-after-free in the scheduled task. PR: 208605
* [net80211] put in a comment about the not-quite-correctness of A-MPDU ↵adrian2016-04-181-0/+8
| | | | | | | | | | | | | | | | | parameters. Although we correctly (now!) calculate the right A-MPDU parameters, the ioctl() has some faulty logic for choosing which to display. The BSS params are what were advertised to us, and we would have chosen the lower of theirs/ours when advertising the HT bits back at them. So, we /should/ track and fix that so we display the correct A-MPDU density and size. However, since I'm a forgetful type, and I don't want to have to re-learn that this is wrong, drop in a comment so I or someone else fixes it. Or, when I discover this again in 4 years, I don't have to go digging too much to remember.
* [net80211] correctly (i hope, wow) do a ticks comparison to limit A-MPDU ↵adrian2016-04-101-1/+1
| | | | | | | | | | | | attempts I was seeing the stack constantly attempt to renegotiate A-MPDU TX even after 3 failures. My hunch is that the direct ticks comparison is failing around the ticks wrap-around point. This failure shouldn't /really/ happen normally, but it turns out being the IBSS master node on FreeBSD doesn't quite setup 11n right, so negotiating A-MPDU TX fails.
* [net80211] unconditionally do A-MPDU RX aging.adrian2016-04-101-12/+2
| | | | | | | | | | | | | It's 2016 and vendors (including us!) still have 802.11n TX/RX sequence handling bugs. It's suboptimal, but I'd rather see us default to handling things in a sensible way. So, just delete the #ifdef'ed code for now. I'll leave the option in so it doesn't break existing configurations. This all started because I've started getting reports about urtwn not working after I enabled 802.11n support, and it's because the ARM kernel configs don't include A-MPDU RX aging.
* [net80211] log the node pointer when calling ht node init/cleanupadrian2016-04-091-6/+7
| | | | | | | | This makes it easier to track which node is having what done do it during normal use. This is likely the eighth time I've done this since I started doing net80211 development, so I think it's about time I just committed it.
* [net80211] add back in the ff/superg node init call that I accidentallyadrian2016-04-091-0/+8
| | | | | | deleted. It's mostly a no-op right now, so it shouldn't have changed behaviour.
* Try to unbreak the build: the 'vap' variable is only used if ieee80211bz2016-04-091-1/+1
| | | | debugging compile is on.
* [net80211] print out the channel type (eg a, b, g, n) when creatingadrian2016-04-091-2/+3
| | | | an IBSS network.
* [net8021] Pull out the ibss check code into a public function.adrian2016-04-092-15/+30
| | | | | | | | | | | | The ath(4) driver now sees beacons and management frames for different BSSIDs in IBSS mode, which is a problem when you're in a very busy IBSS environment. So, expose this function so drivers can use it to check if the current RX node is actually for a BSS we need to pay attention to or not. PR: kern/208644 Sponsored by: Eva Automation. Inc.
* [net80211] revert part of r282405 in order to restore IBSS behaviour.adrian2016-04-091-4/+1
| | | | | | | | | | | | | | | | This prevents nodes being created for peers on BSSes that are not our own. (Ie, same channel, IBSS, but different BSS.) The "IBSS merge" thing was fixed by me enabling "see all beacons" in the ath(4) driver a few months ago. Trouble is, we now need the filtering again. Tested: * ath(4), IBSS, on a very busy IBSS channel with lots (> 15) IBSS networks. PR: kern/208643 Sponsored by: Eva Automation, Inc.
* [net80211] missed commit from last one - always cleanup superg state.adrian2016-04-061-2/+6
|
* [net80211] Initial A-MSDU support for testing / evaluationadrian2016-04-066-72/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A-MSDU is another 11n aggregation mechanism where multiple ethernet frames get LLC encapsulated (so they have a length field), padded, and put in a single MPDU (802.11 MAC frame.) This means it gets sent out as a single frame, with a single seqno, it's acked as one frame, etc. It turns out that, hah, atheros fast frames is almost but not quite like this, so I'm reusing all of the current superg/fast-frames stuff in order to actually transmit A-MSDU. Yes, this means that A-MSDU frames are also only aggregated two at a time, so it's not necessarily a huge win, but it's better than nothing. This doesn't do anything by default - the driver needs to say it does A-MSDU as well as set the AMSDU software TX capability so this code path gets exercised. For now, the only driver that enables this is urtwn. I'll enable it for rsu at some point soon. Tested: * Add an amsdu encap path to aggregate two frames, same as the fast-frames path. * Always do the superg init/teardown and node init/teardown stuff, regardless of whether the nodes are doing fast-frames (the ATH capability stuff.) That way we can reuse it for amsdu. * Don't do AMSDU for multicast/broadcast and EAPOL frames. * If we're doing A-MPDU, then don't bother doing FF/A-MSDU. We can likely do both together, but I don't want to change behaviour. * Teach the fast frames approx txtime logic to support the 11n rates. But, since we don't currently have a full "current rate" support, assume it's HT20, long-gi, etc. That way we overshoot on the TX time estimation, so we're always inside the requirements. (And we only aggregate two frames for now, so we're not really going to exceed that.) * Drop the maximum FF age default down to 2ms, otherwise we end up with some very annoyingly large latencies. TODO: * We only aggregate two ethernet frames, so I'm not checking the max A-MSDU size. But when it comes time to support >2 frames, we should obey that. Tested: * urtwn(4)
* [net80211] rename 11n rate macros into a useful spotadrian2016-04-052-1/+9
| | | | | | | | | * begin moving the 11n macros out of ieee80211_phy.c and into a header so they can be used elsewhere. * rename some of them into the IEEE80211_* namespace. * convert HT_RC_2_MCS() to work with three-stream rates.
* [net80211] note that M_FF will soon mean "fast-frames" or "A-MSDU."adrian2016-04-051-1/+1
|
OpenPOWER on IntegriCloud