Commit Graph

60 Commits

Author SHA1 Message Date
tacha 3fb751b1b5 Make 802.11 devices to work with stealth AP even when scanning
channels marked passive.

From FreeBSD.
2006-06-30 06:17:10 +00:00
elad 874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
christos 5a57baa413 don't use MALLOC with a non-constant size; use malloc instead. 2006-03-17 23:29:07 +00:00
dyoung 25e9e914b4 Miscellaneous ath(4) and net80211 updates and bug-fixes coming from
sam@ and various open source repositories:

ath(4):

        Ignore "phantom" beacon misses: should stabilize connections
        to access points (no more ceaseless link-UP/DOWN indications).
        Also, re-synchronize beacon timer using the TSF in the
        first beacon received after joining a BSS---this should
        also help suppress spurious beacon misses.  I am hopeful
        that this will help ath(4) lossage reported by perry@ and
        smb@.

        Add new configuration through sysctl.

        Use a shorter calibration interval until IQ calibration
        finishes.

        Report antenna noise through radiotap.

        Rudiments of Radar Detection / Dynamic Frequency Selection.

        Update to HAL version 0.9.16.13.

        Update open sources for changes to the HAL API.

        Add HALs for additional architectures: add big-endian ELF
        HALs for sparc64 and for PowerPC.  Also add a Alpha HAL.
        These new HALs are untested under NetBSD.

ath(4) + net80211:

        Make the multicast transmit rate configurable by ioctl.

        Miscellaneous bug fixes.
2006-03-02 03:38:26 +00:00
dyoung 7b6a25ed00 Cosmetic: extract a subroutine ieee80211_update_adhoc_node() from
ieee80211_recv_mgmt().  ieee80211_update_adhoc_node() updates IBSS
nodes based on received beacons and probe responses.  I extract a
subroutine to maintain a tolerable indentation level.
2005-12-29 10:06:52 +00:00
dyoung 5bbf511244 In IBSS mode, track all nodes' change of BSSID, not only the BSS
node's change.  Thanks to Konstantin Kabassanov for pointing out
the problem.
2005-12-16 11:27:33 +00:00
dyoung ac7bff6e7c Cosmetic: normalize whitespace. 2005-12-16 10:04:58 +00:00
dyoung 277fb4409c Cosmetic: remove unnecessary stairstep. 2005-12-08 23:08:39 +00:00
dyoung 8e41de9845 Always record a change of the BSS node's BSSID, even if a desired
BSSID is set.

In IBSS mode, if the BSS node's BSSID changes, and a desired BSSID
is *not* set, make a RUN->RUN transition to give the driver an
opportunity to reprogram its BSSID filter.  This fixes a bug where
both wlanctl(8) and ifconfig(8) indicated that an interface had
joined a new BSS, but no packets would get through, except in
promiscuous mode, because the hardware still filtered packets based
on the old BSSID.
2005-12-08 20:19:49 +00:00
dyoung 3d578b96da In adhoc mode, mark the "BSS" node's (ic->ic_bss) change of BSSID.
If the operator did not configure a "desired BSSID," then we simply
adopt the BSS node's new BSSID.  If the operator configured a
"desired BSSID," the new BSSID is (probably) not the desired one,
so start scanning for it.

Note that a change of BSSID will occur as two ad hoc networks merge.
2005-11-23 04:32:12 +00:00
dyoung 461cd4dbb5 Repair adhoc mode.
1 Complete initialization of "faked up" ieee80211_nodes,
          whose capabilities and other fields are wrong, when we
          first receive a beacon or probe response from the
          corresponding neighbor.  This entails factoring
          ieee80211_init_neighbor out of ieee80211_add_neighbor.

        2 In adhoc mode, ic->ic_bss is present in the neighbors
          table, ic->ic_sta, and it is not necessarily the wrong
          node on which to mark statistics for a rx'd packet.  Do
          not reject ic->ic_bss and fake-up a new node without
          comparing its MAC address with the address of the sender
          in the rx'd packet.  This fixes a memory leak.
2005-11-20 10:04:21 +00:00
he 6e11a90e46 Add an overlooked #if NBPFILTER > 0 / #endif. 2005-11-19 21:09:17 +00:00
riz ba27c061d3 Move the (ALTQ-conditional) declaration of struct altq_pktattr pktattr
into ieee80211_deliver_data(), since the code which uses it has been
moved there.  Fixes build with options ALTQ.

reviewed by christos@
2005-11-19 01:06:21 +00:00
skrll 87515e34ff Resolve conflicts and adapt to NetBSD.
Thanks to dyoung@, scw@, and perry@ for help testing.

2005-08-30 15:27  avatar

Properly set ic_curchan before calling back to device driver to do channel
switching(ifconfig devX channel Y).  This fix should make channel changing
works again in monitor mode.

Submitted by:	sam
X-MFC-With:	other ic_curchan changes

2005-08-13 18:50  sam

revert 1.64: we cannot use the channel characteristics to decide when to
do 11g erp sta accounting because b/g channels show up as false positives
when operating in 11b.

Noticed by:	Michal Mertl

2005-08-13 18:31  sam

Extend acl support to pass ioctl requests through and use this to
add support for getting the current policy setting and collecting
the list of mac addresses in the acl table.

Submitted by:	Michal Mertl (original version)
MFC after:	2 weeks

2005-08-10 18:42  sam

Don't use ic_curmode to decide when to do 11g station accounting,
use the station channel properties.  Fixes assert failure/bogus
operation when an ap is operating in 11a and has associated stations
then switches to 11g.

Noticed by:	Michal Mertl
Reviewed by:	avatar
MFC after:	2 weeks

2005-08-10 17:22  sam

Clarify/fix handling of the current channel:
o add ic_curchan and use it uniformly for specifying the current
  channel instead of overloading ic->ic_bss->ni_chan (or in some
  drivers ic_ibss_chan)
o add ieee80211_scanparams structure to encapsulate scanning-related
  state captured for rx frames
o move rx beacon+probe response frame handling into separate routines
o change beacon+probe response handling to treat the scan table
  more like a scan cache--look for an existing entry before adding
  a new one; this combined with ic_curchan use corrects handling of
  stations that were previously found at a different channel
o move adhoc neighbor discovery by beacon+probe response frames to
  a new ieee80211_add_neighbor routine

Reviewed by:	avatar
Tested by:	avatar, Michal Mertl
MFC after:	2 weeks

2005-08-09 11:19  rwatson

Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags.  Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags.  This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by:	pjd, bz
MFC after:	7 days

2005-08-08 19:46  sam

Split crypto tx+rx key indices and add a key index -> node mapping table:

Crypto changes:
o change driver/net80211 key_alloc api to return tx+rx key indices; a
  driver can leave the rx key index set to IEEE80211_KEYIX_NONE or set
  it to be the same as the tx key index (the former disables use of
  the key index in building the keyix->node mapping table and is the
  default setup for naive drivers by null_key_alloc)
o add cs_max_keyid to crypto state to specify the max h/w key index a
  driver will return; this is used to allocate the key index mapping
  table and to bounds check table loookups
o while here introduce ieee80211_keyix (finally) for the type of a h/w
  key index
o change crypto notifiers for rx failures to pass the rx key index up
  as appropriate (michael failure, replay, etc.)

Node table changes:
o optionally allocate a h/w key index to node mapping table for the
  station table using the max key index setting supplied by drivers
  (note the scan table does not get a map)
o defer node table allocation to lateattach so the driver has a chance
  to set the max key id to size the key index map
o while here also defer the aid bitmap allocation
o add new ieee80211_find_rxnode_withkey api to find a sta/node entry
  on frame receive with an optional h/w key index to use in checking
  mapping table; also updates the map if it does a hash lookup and the
  found node has a rx key index set in the unicast key; note this work
  is separated from the old ieee80211_find_rxnode call so drivers do
  not need to be aware of the new mechanism
o move some node table manipulation under the node table lock to close
  a race on node delete
o add ieee80211_node_delucastkey to do the dirty work of deleting
  unicast key state for a node (deletes any key and handles key map
  references)

Ath driver:
o nuke private sc_keyixmap mechansim in favor of net80211 support
o update key alloc api

These changes close several race conditions for the ath driver operating
in ap mode.  Other drivers should see no change.  Station mode operation
for ath no longer uses the key index map but performance tests show no
noticeable change and this will be fixed when the scan table is eliminated
with the new scanning support.

Tested by:	Michal Mertl, avatar, others
Reviewed by:	avatar, others
MFC after:	2 weeks

2005-08-08 06:49  sam

use ieee80211_iterate_nodes to retrieve station data; the previous
code walked the list w/o locking

MFC after:	1 week

2005-08-08 04:30  sam

Cleanup beacon/listen interval handling:
o separate configured beacon interval from listen interval; this
  avoids potential use of one value for the other (e.g. setting
  powersavesleep to 0 clobbers the beacon interval used in hostap
  or ibss mode)
o bounds check the beacon interval received in probe response and
  beacon frames and drop frames with bogus settings; not clear
  if we should instead clamp the value as any alteration would
  result in mismatched sta+ap configuration and probably be more
  confusing (don't want to log to the console but perhaps ok with
  rate limiting)
o while here up max beacon interval to reflect WiFi standard

Noticed by:	Martin <nakal@nurfuerspam.de>
MFC after:	1 week

2005-08-06 05:57  sam

fix debug msg typo

MFC after:	3 days

2005-08-06 05:56  sam

Fix handling of frames sent prior to a station being authorized
when operating in ap mode.  Previously we allocated a node from the
station table, sent the frame (using the node), then released the
reference that "held the frame in the table".  But while the frame
was in flight the node might be reclaimed which could lead to
problems.  The solution is to add an ieee80211_tmp_node routine
that crafts a node that does exist in a table and so isn't ever
reclaimed; it exists only so long as the associated frame is in flight.

MFC after:	5 days

2005-07-31 07:12  sam

close a race between reclaiming a node when a station is inactive
and sending the null data frame used to probe inactive stations

MFC after:	5 days

2005-07-27 05:41  sam

when bridging internally bypass the bss node as traffic to it
must follow the normal input path

Submitted by:	Michal Mertl
MFC after:	5 days

2005-07-27 03:53  sam

bandaid ni_fails handling so ap's with association failures are
reconsidered after a bit; a proper fix involves more changes to
the scanning infrastructure

Reviewed by:	avatar, David Young
MFC after:	5 days

2005-07-23 01:16  sam

the AREF flag is only meaningful in ap mode; adhoc neighbors now
are timed out of the sta/neighbor table

2005-07-23 00:25  sam

o move inactivity-related debug msgs under IEEE80211_MSG_INACT
o probe inactive neighbors in adhoc mode (they don't have an
  association id so previously were being timed out)

MFC after:	3 days

2005-07-22 22:11  sam

split xmit of probe request frame out into a separate routine that
takes explicit parameters; this will be needed when scanning is
decoupled from the state machine to do bg scanning

MFC after:	3 days

2005-07-22 21:48  sam

split 802.11 frame xmit setup code into ieee80211_send_setup

MFC after:	3 days

2005-07-22 18:57  sam

simplify ic_newassoc callback

MFC after:	3 days

2005-07-22 18:54  sam

simplify ieee80211_ibss_merge api

MFC after:	3 days

2005-07-22 18:50  sam

add stats we know we'll need soon and some spare fields for future expansion

MFC after:	3 days

2005-07-22 18:45  sam

simplify tim callback api

MFC after:	3 days

2005-07-22 18:42  sam

don't include 802.3 header in min frame length calculation as it may
not be present for a frag; fixes problem with small (fragmented) frames
being dropped

Obtained from:	Atheros
MFC after:	3 days

2005-07-22 18:36  sam

simplify ieee80211_node_authorize and ieee80211_node_unauthorize api's

MFC after:	3 days

2005-07-22 18:31  sam

simplifiy ieee80211_send_nulldata api

MFC after:	3 days

2005-07-22 18:29  sam

simplify rate set api's by removing ic parameter (implicit in node reference)

MFC after:	3 days

2005-07-22 18:21  sam

reject association requests with a wpa/rsn ie when wpa/rsn is not
configured on the ap; previously we either ignored the ie or (possibly)
failed an assertion

Obtained from:	Atheros
MFC after:	3 days

2005-07-22 18:16  sam

missed one in last commit; add device name to discard msgs

2005-07-22 18:13  sam

include device name in discard msgs

2005-07-22 18:12  sam

add diag msgs for frames discarded because the direction field is wrong

2005-07-22 18:08  sam

split data frame delivery out to a new function ieee80211_deliver_data

2005-07-22 18:00  sam

o add IEEE80211_IOC_FRAGTHRESHOLD for getting+setting the
  tx fragmentation threshold
o fix bounds checking on IEEE80211_IOC_RTSTHRESHOLD

MFC after:	3 days

2005-07-22 17:55  sam

o add IEEE80211_FRAG_DEFAULT
o move default settings for RTS and frag thresholds to ieee80211_var.h

2005-07-22 17:50  sam

diff reduction against p4: define IEEE80211_FIXED_RATE_NONE and use
it instead of -1

2005-07-22 17:37  sam

add flags missed in last merge

2005-07-22 17:36  sam

Diff reduction against p4:
o add ic_flags_ext for eventual extention of ic_flags
o define/reserve flag+capabilities bits for superg,
  bg scan, and roaming support
o refactor debug msg macros

MFC after:	3 days

2005-07-22 06:17  sam

send a response when an auth request is denied due to an acl;
might be better to silently ignore the frame but this way we
give stations a chance of figuring out what's wrong

2005-07-22 06:15  sam

remove excess whitespace

2005-07-22 05:55  sam

use IF_HANDOFF when bridging frames internally so if_start gets
called; fixes communication between associated sta's

MFC after:	3 days

2005-07-11 04:06  sam

Handle encrypt of arbitarily fragmented mbuf chains: previously
we bailed if we couldn't collect the 16-bytes of data required
for an aes block cipher in 2 mbufs; now we deal with it.  While
here make space accounting signed so a sanity check does the
right thing for malformed mbuf chains.

Approved by:	re (scottl)

2005-07-11 04:00  sam

nuke assert that duplicates real check

Reviewed by:	avatar
Approved by:	re (scottl)
2005-11-18 16:40:08 +00:00
dyoung 5f9f2606fc Reduce diffs against FreeBSD by removing some redundant checks on
the BSSID and destination address.
2005-09-24 23:04:51 +00:00
yamt 2e85eff671 - introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.
2005-08-18 00:30:58 +00:00
dyoung 80b91eea2d Import changes in FreeBSD's net80211 between 2005-05-18 and 2005-07-11.
A summary of changes is forthcoming.
2005-07-26 22:52:47 +00:00
dyoung 8feed843ef Restore ALTQ-classification to the AP-bridge, as pointed out by
Bernd Ernesti.
2005-07-03 21:18:42 +00:00
dyoung fdf8c16f71 Refine an ieee80211_node-match using the SSID and the channel before
increasing the _node's beacon/probe count.
2005-07-03 21:10:27 +00:00
dyoung 74988b0f25 Do not build AP support if 'options IEEE80211_NO_HOSTAP'. I will
use this in the INSTALL kernel to save some space.
2005-06-26 04:31:51 +00:00
dyoung 9063402978 Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD.  Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]).  Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
2005-06-22 06:14:51 +00:00
christos a1f8461e23 avoid shadowing of m1 2005-05-30 04:16:10 +00:00
perry f07677dd81 nuke trailing whitespace 2005-02-26 22:45:09 +00:00
dyoung a4bb6a73ed Fix a misuse of ether_sprintf so that IBSS merges are printed
xx:xx:xx:xx:xx:xx -> yy:yy:yy:yy:yy:yy instead of
xx:xx:xx:xx:xx:xx -> xx:xx:xx:xx:xx:xx.
2005-01-16 11:36:54 +00:00
dyoung 5dc6377838 IBSS-merge clean-up, inspired by some Linux patches from Jon Anderson
(mail@janderson.ca): remove ieee80211_ibss_merge's TSFT argument.
Do the TSFT comparison in the drivers (ath, atw).  Remove a lot of
extraneous debug statements from ieee80211_ibss_merge.

Set the ieee80211_node's state to IEEE80211_STA_BSS after it's been
copied to the ic_bss, not before.

In struct ieee80211_node, make the ni_tstamp field a union of a
uint64_t and the 8 TSF octets so that it's easier to compare a
neighbor's TSF with the local TSF.

Log IBSS merges (Greg Troxel's suggestion).  Also log IBSS creation.
These are rare and important events that deserve to be logged.
2005-01-04 00:56:51 +00:00
dyoung 8abb07d1ac Make the node table into an LRU cache: least-recently used nodes
are at the end of the node queue.  Change the reference-counting
discipline: ni->ni_refcnt indicates how many times net80211 has
granted ni to the driver.  Every node in the table with ni_refcnt=0
is eligible to be garbage-collected.  The mere presence of a node
in the table does not any longer indicate its auth/assoc state;
nodes have a ni_state variable, now.  A sysctl,
net.link.ieee80211.maxnodecache, controls the maximum LRU cache
size.

While I am here, patch ieee80211_find_node_for_beacon to do a "best
match" by bssid/ssid/channel, not a "perfect match."  This keeps
net80211 from caching duplicate nodes in the table.
2004-08-10 00:57:20 +00:00
mycroft 8e9a02ab5e Put a check for an impossible case inside '#ifdef DIAGNOSTIC'. 2004-07-30 17:45:21 +00:00
mycroft 88a8480ea3 Implement passive scanning for APs in station and host-AP mode:
ieee80211_input():
  * Do not discard management frames in station mode just because they have
    the wrong BSSID.
  * Do not discard beacons in station and host-AP mode when not scanning.
  * Some minor rearrangement.  Update node statistics even if the packet is
    rejected.
  ieee80211_recv_mgmt():
  * Accept probe responses and beacons in station and host-AP even when not
    scanning.
  * Do not immediately free the node created by a beacon or probe response.
XXX Should I check BSSIDs more carefully in ieee80211_recv_mgmt() --
specifically for ASSOC_RESP, REASSOC_RESP, AUTH, DEAUTH and DISASSOC?

Fix a problem with APs that advertise multiple SSIDs:
Change the footprint of ieee80211_find_node_with_channel() to take a SSID as
well, and, if not empty, compared it with the existing nodes.  This causes
us to allocate multiple nodes for the same AP.  Without this we were only
leaving one SSID in the node table, which might not be the desired one, and
so the interface would fail to fully initialize.  (Reported by he@ with a
Cisco 350 AP.)
2004-07-29 22:28:05 +00:00
dyoung 6f9ff5e059 Vastly simplify ieee80211_ibss_merge, eliminating the needless
callbacks.  Change the reference IBSS-merge implementation in atw
to match.
2004-07-28 08:12:49 +00:00
dyoung ce488d2bf7 Pull the IBSS merge logic out of atw and into net80211, since ath
will eventually share it.

In the IBSS merge logic, check conditions in a different order so
that they run faster in the common case---no merge.  Fix the
rate-limiting on the debug outputs (enabled by IFF_LINK0).
2004-07-24 23:53:49 +00:00
mycroft f526e7326b Cleanup of ieee80211_node from madwifi:
* Don't use ifp pointers; use ieee80211com.
* Implement the locking macros that are used under FreeBSD and Linux.
2004-07-23 10:15:13 +00:00
mycroft 3551583171 Changes from madwifi:
Abstract some of the node management code into separate functions, and use them
throughout, plugging memory leaks.
Allocate the AID allocation map dynamically.
2004-07-23 09:22:15 +00:00
mycroft 50d44f4f07 IEEE80211_F_WEPON -> IEEE80211_F_PRIVACY 2004-07-23 08:31:39 +00:00
mycroft 75f8366d87 Yet more DPRINTF() cleanup. 2004-07-23 08:25:25 +00:00
mycroft a02b46e848 More diff reduction; mainly IEEE80211_DPRINTF() stuff. 2004-07-23 08:05:00 +00:00
mycroft f0546001c6 Diff reduction vs. madwifi.
Change the signature of IEEE80211_DPRINTF() so that it uses a bitmask, and
convert some of the if_printf()s to IEEE80211_DPRINTF()s.  XXX I'm using a
global variable at the moment rather than per-interface.
2004-07-23 06:44:55 +00:00
dyoung c9f71eaeb7 Prevent ad hoc lossage: copy the SSID from a beacon into the
beacon-sender's ieee80211_node, if ni->ni_esslen == 0.  This fixes
WEP for Matthew.  I think that it also will save us from IBSS
splits.

Thanks again, Matthew Gream.
2004-05-31 11:12:24 +00:00
dyoung 1ff6496e8c Incorporate new authentication debug statements from FreeBSD.
Fix authentication where I had botched it with the FreeBSD import.
(In FreeBSD, net80211 is strangely subroutine-averse, so where we
have ieee80211_auth_open and ieee80211_auth_shared, they incorporate
all of ieee80211_auth_open into ieee80211_recv_mgmt.  I had not
realized that was why the 20 lines of new code.)
2004-05-06 02:56:48 +00:00
dyoung 1d6dd12bbb From FreeBSD. Be more consistent with ieee80211_node
reference counts, and treat ad hoc nodes properly.  More complete
authentication support.
2004-04-30 23:58:08 +00:00
mrg b8931a9257 fix int/size_t issues in debug code. 2004-02-11 10:19:32 +00:00
dyoung c4ac88ea48 This patch from Sam Leffler fixes bugs in the client-side of
shared-key authentication. This should help with your Apple products.
Any bugs, new or old, are mine.
2004-02-01 08:25:57 +00:00
onoe b001a515f8 For FH phy, accept beacons whose hop pattern in FH params is different
from current setting, because the rssi value would be correct once the
datagram is received regardless the hopping pattern.
2004-01-15 08:16:24 +00:00
dyoung 5bcaa60a0e Don't panic on frames without a second address field. Tap them for
BPF, instead.
2004-01-14 04:11:09 +00:00
dyoung 8c117e1a38 NetBSD's KASSERT takes just one argument while FreeBSD's takes two,
so I have added IASSERT(cond, complaint) to the compatibility header
file and s/KASSERT/IASSERT/'d.
2004-01-13 23:37:29 +00:00
dyoung 9280f4b428 Synchronize with FreeBSD sources from 12 Dec 2003. 2003-12-14 09:56:53 +00:00
dyoung 4232da0fda Diagnostics: complain if packet decapsulation fails. 2003-12-07 05:34:22 +00:00
mycroft c41a3efdb2 Eliminate bogus initializer. 2003-10-27 17:11:19 +00:00
christos 2017bf9a94 Fix uninitialized variable warning 2003-10-25 18:31:59 +00:00
mycroft f336bf5b29 Do that replacement in one more place. 2003-10-25 03:18:37 +00:00
mycroft 3ebaf267f3 Replace a constant with a symbol. 2003-10-25 01:17:39 +00:00