Commit Graph

354 Commits

Author SHA1 Message Date
sam
31c555966c use ieee80211_iterate_nodes to retrieve station data; the previous
code walked the list w/o locking

MFC after:	1 week
2005-08-08 05:49:29 +00:00
sam
a71123cebf 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-08 03:30:57 +00:00
sam
24da388011 fix debug msg typo
MFC after:	3 days
2005-08-06 04:57:27 +00:00
sam
820d1d2e7c 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-08-06 04:56:49 +00:00
sam
2cd7f030b7 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-31 06:12:32 +00:00
sam
eb5cee9b56 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 04:41:25 +00:00
sam
63e3a582cc 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-27 02:53:09 +00:00
sam
19bd96d14c the AREF flag is only meaningful in ap mode; adhoc neighbors now
are timed out of the sta/neighbor table
2005-07-23 00:16:46 +00:00
sam
5707944fdd 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 23:25:46 +00:00
sam
e4bb8fb68f 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:11:26 +00:00
sam
bd0efadacd split 802.11 frame xmit setup code into ieee80211_send_setup
MFC after:	3 days
2005-07-22 20:48:11 +00:00
sam
0bcf56e9b9 simplify ic_newassoc callback
MFC after:	3 days
2005-07-22 17:57:16 +00:00
sam
f149e56110 simplify ieee80211_ibss_merge api
MFC after:	3 days
2005-07-22 17:54:40 +00:00
sam
c12da29e65 add stats we know we'll need soon and some spare fields for future expansion
MFC after:	3 days
2005-07-22 17:50:13 +00:00
sam
7e6c91d028 simplify tim callback api
MFC after:	3 days
2005-07-22 17:45:48 +00:00
sam
dd6e7b2fa5 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 17:42:08 +00:00
sam
7c3e01b45a simplify ieee80211_node_authorize and ieee80211_node_unauthorize api's
MFC after:	3 days
2005-07-22 17:36:12 +00:00
sam
0fe58ae3f0 simplifiy ieee80211_send_nulldata api
MFC after:	3 days
2005-07-22 17:31:18 +00:00
sam
f661a632a6 simplify rate set api's by removing ic parameter (implicit in node reference)
MFC after:	3 days
2005-07-22 17:29:03 +00:00
sam
5531f8a211 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 17:21:36 +00:00
sam
14689edafa missed one in last commit; add device name to discard msgs 2005-07-22 17:16:37 +00:00
sam
c461cb9244 include device name in discard msgs 2005-07-22 17:13:44 +00:00
sam
0303ee7475 add diag msgs for frames discarded because the direction field is wrong 2005-07-22 17:12:05 +00:00
sam
130e2c1101 split data frame delivery out to a new function ieee80211_deliver_data 2005-07-22 17:08:38 +00:00
sam
ecefd1689d 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:00:48 +00:00
sam
6f738197e3 o add IEEE80211_FRAG_DEFAULT
o move default settings for RTS and frag thresholds to ieee80211_var.h
2005-07-22 16:55:27 +00:00
sam
3876d0ac68 diff reduction against p4: define IEEE80211_FIXED_RATE_NONE and use
it instead of -1
2005-07-22 16:50:18 +00:00
sam
0ad70d5aa7 add flags missed in last merge 2005-07-22 16:37:56 +00:00
sam
b04f929442 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 16:36:12 +00:00
sam
186ec2eefb 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 05:17:52 +00:00
sam
edad1e6d8a remove excess whitespace 2005-07-22 05:15:53 +00:00
sam
7c66d9190d use IF_HANDOFF when bridging frames internally so if_start gets
called; fixes communication between associated sta's

MFC after:	3 days
2005-07-22 04:55:40 +00:00
sam
097175bde2 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 03:06:23 +00:00
sam
e1d30f6c56 nuke assert that duplicates real check
Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-11 03:00:20 +00:00
sam
aa33c1cc86 Change default key allocation method to do the right thing for
legacy parts (i.e. those that have 4 global key slots).  We
blindly assign unicast keys to key slot 0.  Devices that need
alternate allocation logic must override this method.

Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-09 23:15:30 +00:00
sam
514091a2b5 correct check for high priority wme traffic
Noticed by:	Ralf Assmann
Reviewed by:	apatti
Approved by:	re (scottl)
2005-07-08 22:49:26 +00:00
sam
20d38d6afa fix another instance of the MORE_DATA bit handling for frames on the
power save queue (missed in previous commit)

Submitted by:	Bruno Randolf
Approved by:	re (scottl)
2005-07-08 16:36:02 +00:00
sam
61cabe0353 add "pureg" mode for ap operation: reject association requests from
11b-only stations when operating in 11g

Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-06 15:38:27 +00:00
sam
636341c188 Fix handling of data frames queued for a station in power save mode:
don't mark the MORE_DATA bit when taking it off the ps queue, there's
no 802.11 header then; we must wait to do this at encap time so
mark the mbuf instead.

Reviewed by:	avatar
Approved by:	re (scottl)
Obtained from:	Atheros
2005-07-06 01:55:17 +00:00
sam
42be4e8353 Fix race condition in handling node reference counts for authenticating
stations in ap mode.  Track when a node's first auth frame is
received and use this to decide whether or not to bump the refcnt.
This insures we only ever bump the refcnt once.

Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-06 01:51:44 +00:00
avatar
9fb6cc8fde Only update the scan entry state based on newly received frames.
This fixes duplicative BSS entries(memory leaks as well) listed in
"ifconfig dev list scan" when a station fails to associate with an AP.

Reviewed by:	sam
Approved by:	re (scottl)
2005-07-06 01:31:34 +00:00
sam
89b6b99eed remove auto-add of IEEE80211_KEY_GROUP; all the apps that need to
set it have been fixed

Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-05 18:05:25 +00:00
sam
b19edfa1af o when setting a wpa key, hold a ref on the bss node;
fixes a ref cnt leak
o make unicast key handling on delete identical to set
o change legacy wep key api to reset the 802.11 state
  machine for backwards compatibility

Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-05 17:35:35 +00:00
sam
01de859665 when operating in ap mode, explicitly drop associated/authenticated
stations when transitioning to INIT state (e.g. as a result of
changing state at the 802.11 level)

Approved by:	re (scottl)
2005-07-04 01:29:41 +00:00
sam
4e4b8392b5 revert 1.53; it breaks ibss merge
Noticed by:	Bruno Randolf
Approved by:	re (dwhite)
2005-06-13 21:01:06 +00:00
sam
105387b318 don't look at the wme ie in a beacon unless we negotiated use 2005-06-10 21:30:29 +00:00
brooks
567ba9b00a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
sam
3eaa67c3ad validate the bssid for non-data frames too when operating in
adhoc/ahdemo/hostap modes
2005-06-10 16:14:48 +00:00
sam
6ee6d88916 o fix wpa w/ wme: don't strip the QoS header on recv as tkip requires
it; instead pass the space occupied by the header down into the
  crypto modules (except in the demic case which needs it only when
  doing int in s/w)
o while here fix defrag to strip the header from 2nd and later frames
o teach decap code how to handle 4-address frames
2005-06-10 16:11:24 +00:00
sam
836efd552e mark stations authorized during recv processing instead of doing it
as a side effect of sending an auth success frame; sending mgmt
frames should not have side effects
2005-06-10 05:04:42 +00:00
sam
a161b6a7bc move AID implementation defines from the protocol definitions to
where they are used
2005-06-10 04:42:34 +00:00
sam
d6dd7e9d2a accept diassoc frame in ASSOC state 2005-06-10 04:37:05 +00:00
sam
f524fb8e7d pull some debug msgs up so they're seen more often 2005-06-10 01:48:57 +00:00
sam
6bac24f11a kick the state machine when we receive failure notice from an ap (when
operating in sta mode); this speeds up the state machine, previously
we were acting on a timeout
2005-06-10 01:47:28 +00:00
sam
78c35576de discard open auth requests in adhoc mode 2005-06-10 01:43:28 +00:00
sam
afe76ba36a reject open auth requests when shared key auth is configured
Obtained from:	Atheros
2005-06-10 01:41:59 +00:00
sam
87f793a9fe add ieee80211_send_error to encapsulate an idiom 2005-06-10 01:40:58 +00:00
sam
07fc2e05e9 o always check if ic_set_tim is !NULL before using it
o add missing call to clear tim after flushing ps q
2005-06-10 01:38:02 +00:00
sam
e32bb658a4 mark state for protection only when operating in 11g 2005-06-10 01:35:21 +00:00
sam
cbf7030d15 don't reject station based on the PRIVACY bit in the capabilities;
the 802.11 spec says not to

Obtained from:	Atheros
2005-06-10 01:33:47 +00:00
sam
adbfe7192e correct checks for rate set compatibility 2005-06-10 01:31:28 +00:00
sam
7b2e90955c record tstamp from beacons received in station mode when associated;
this is needed by drivers that want to resync their timers based on
the tsf of the last recv'd beacon frame
2005-06-10 01:29:21 +00:00
sam
0a48913a6f o collect dtim period+count from beacons in station mode so drivers
can better program beacon timers
o leave placeholder in com structure for future ap/adhoc mode tim support

Reviewed by:	avatar
2005-06-09 04:05:43 +00:00
sam
2a3c2a37f6 Change the MLME ASSOCIATE ioctl to accept either a ssid, a bssid,
or a bssid+ssid. This is needed for later versions of wpa_supplicant
and for forthcoming addons to wpa_supplicant.

Note this is an api change and applications must be rebuilt.
2005-06-07 23:37:49 +00:00
sam
b04dca4ae5 Don't clock the state machine in various cases when roaming is set
to manual; this helps keep wpa_supplicant in sync.
2005-06-07 23:31:36 +00:00
sam
24d4beb312 WPA/802.11i interoperability fixes:
o only include capabilities word in the WPA ie when non-zero and
  not preauth
o always include the capabilities in the RSN ie

Obtained from:	Atheros
2005-06-07 00:08:48 +00:00
sam
5bab97118d add force flag to enmic/demic crypto api for use in xmit fragmentation
and h/w mic verification

Reviewed by:	avatar
2005-06-06 04:04:38 +00:00
sam
8ace9dabca Revise crypto api lightly to improve group key handling:
o don't pre-assign key index to the global key table entries so device
  has a chance to decide what to use
o make ieee80211_crypto_newkey take the desired flags as an argument
  instead of wacking the key structure directly; this eliminates a
  bunch of code warts
o add a new flag IEEE80211_KEY_GROUP to indicate a key is a WPA Group
  key so devices don't need to guess (temporarily add this flag in the
  ioctl code until we can get wpa_supplicant+hostapd updated)
o shuffle IEEE80211_KEY_* bits to move flags used internally to the high
  nibble of the flags word

Reviewed by:	Tai-hwa Liang
2005-04-12 17:55:13 +00:00
sam
4a61af733a remove extern from function decls 2005-04-04 04:27:20 +00:00
sam
2425695845 change ieee80211_input to return the frame type or -1 2005-04-04 02:32:56 +00:00
sam
50f9633899 pass re-association events up using a new message type 2005-03-29 19:36:42 +00:00
sam
eabc12aec2 when WPA is enabled discard association requests w/o a WPA ie
Submitted by:	Divy Le Ray
2005-03-26 07:15:34 +00:00
sam
262d235182 don't include wme ie in probe request frames; it was meant for probe response
frames--move it there

Noticed by:	Ghislain Mary
Submitted by:	Michael Wong
2005-03-26 07:11:31 +00:00
sam
c0c5a03a41 correct comparison for null ptr
Noticed by:	Coverity Prevent analysis tool
2005-03-16 20:42:00 +00:00
sam
9b7f94f833 avoid potential array index by -1
Noticed by:	Coverity Prevent analysis tool
2005-03-16 20:40:48 +00:00
sam
0ea8247d55 eliminate use after free in debug code
Noticed by:	Coverity Prevent analysis tool
2005-03-16 20:39:05 +00:00
sam
bddcc80ceb kill dead code
Noticed by:	Coverity Prevent analysis tool
2005-03-16 20:35:23 +00:00
sam
228aadaa15 honor any desired bssid when creating an ibss
Prodded by:	David Young
Obtained from:	netbsd
2005-03-08 17:04:14 +00:00
wpaul
8afa2c4c26 Recently, it was reported to me that you could provoke a double fault
panic with the NDISulator if you did "ifconfig ndis0 10.0.0.1/24,"
whereas "ifconfig ndis0 10.0.0.1/24 up" worked fine. The double fault
was caused by the ifconfig thread running out of kernel stack space.
(This was partly due to the NDIsulator using a couple of big buffers on
the stack, but even after fixing that the double fault persisted.)

It turns out that ndis_init() is called in both cases, but in the first
case the code path passes through ieee80211_ioctl(), and it turns out
ieee80211_ioctl() consumes a whopping 2400 bytes of stack space.
Apparently, gcc -O2 causes the ieee80211_ioctl_get80211() routine to
be inlined into ieee80211_ioctl(), and for some reason which I do not
fully understand, this causes ieee80211_ioctl() to consume an extra 2K
of stack space.

To prevent this overly agressive optimization, ieee80211_ioctl_get80211()
is now declared with __attribute__ ((noinline)). With this change,
ieee80211_ioctl() now only reserves about 200 bytes of stack instead of 2400.
2005-03-03 17:35:05 +00:00
sam
9b2bcce14f mark timestamp for pending fragments
Noticed by:	Jeffrey D. Chung
2005-02-23 04:52:30 +00:00
sam
bfba17efd6 rev 1.19 fixed wpa supplicant but broke wpa authenticator; when operating
as an authenticator need to always check for the unicast key in the node
(as was the case before)

Submitted by:	Divy Le Ray
2005-02-10 17:00:48 +00:00
sam
9b44db51a1 propagate state kept in the bss node when re-creating the node
on state transitions; this is a stopgap measure, need to rethink
how we do management of this state

Identified by:	Divy Le Ray
2005-02-10 16:59:04 +00:00
sam
a1edfec034 correct check for unicast key being setup; wpa_supplicant in particular
uses only the global key state so looking in the per-node key slot is wrong

Submitted by:	Tai-hwa Liang
2005-02-03 16:21:07 +00:00
sam
217734da84 supply a default ic_reset method for drivers; the ioctl code expect this
method to always be setup

Submitted by:	Tai-hwa Liang
2005-01-27 17:39:17 +00:00
sam
e0b285228a update node reference count debug msgs to include the node address
since the mac address may not be sufficient to uniquely identify a node
2005-01-24 20:50:20 +00:00
sam
a55551873c clear IEEE80211_F_WMEUPDATE when building the initial beacon frame so we
don't do an update on the first beacon
2005-01-24 20:41:12 +00:00
sam
c504db8755 noop change so RUN->RUN transition isn't considered invalid
(it happens on ibss merge)
2005-01-24 20:39:29 +00:00
sam
d07ff12dc9 add macros to convert between txop's and usecs 2005-01-24 20:38:26 +00:00
sam
01ce092a3a o clarify that beacon interval settings are in TU's, not ms
o add macros to convert between TU's and ms
2005-01-24 19:39:07 +00:00
sam
459bcc3dba statically allocate the station/neighbor node table; the deferred
allocation scheme introduced a race condition during device state
transitions
2005-01-24 19:32:10 +00:00
sam
822cad40f8 handle potential stale values of bssid in neighbor nodes that
can occur after an ibss merge

Submitted by:	David Young
2005-01-22 20:33:37 +00:00
sam
7a9676cb41 when ssid suppression is enabled don't respond to probe requests
unless our ssid is specified
2005-01-22 20:31:22 +00:00
sam
78282d6a1d be consistent in naming inactivity timers;
net.wlan.X.inact -> net.wlan.X.inact_run
2005-01-22 20:29:23 +00:00
sam
c1c8fdfa03 o replace out-of-line copy of FCS w/ a flag that indicates the
frame includes FCS (requires applications to be updated, but since
  we weren't doing the out-of-line FCS stuff anyway app changes
  were needed already)
o add a flag to indicate padding exists between the 802.11 header and
  the payload (e.g. for Atheros cards)
o diff reducation against netbsd

MFC after:	1 week
2005-01-22 20:12:05 +00:00
sam
8ec9f729de when a station is timed out for inactivity, remove it from the table
so it isn't considered again
2005-01-20 02:59:21 +00:00
sam
3973fcd768 explicitly avoid timing out ourself due to inactivity; it
can easily happen if the bss is quiet
2005-01-20 02:54:18 +00:00
sam
2b292030fb fix refcnt leak in adhoc mode: entries in the neighbor table
created due to rx'd frames had an extra reference
2005-01-20 02:53:11 +00:00
sam
2138a8301b remove debug msg from ieee80211_iterate_nodes; it makes logs very noisy
as onoe rate control invokes this once a second
2005-01-18 20:35:39 +00:00
sam
ff12c179c8 avoid possible null pointer deref when refcnt debugging is enabled; the
node may be orphaned

Submitted by:	Tai-hwa Liang
2005-01-18 20:34:22 +00:00
sam
ae59d17866 Explicitly ignore ibss merge requests when the node is ic_bss. This can
happen on the first management frame received from a neighbor; we assume
any merge candidate will send more frames and those should be processed
with a suitable table entry.

Stepped on by:	Tai-hwa Liang
2005-01-18 20:30:16 +00:00
sam
c32261430c Simplify the logic for checking the scan candidates at the end of a scan.
Hold a lock on the table instead of futzing with reference counts which
was potentially dangerous except drivers were quiescent while we did this
so the table contents never changed.  Disable the hack logic for removing
scan candidates with multiple association failures; it's never done the
right thing and will be fixed correctly with background scanning goes in.
2005-01-18 20:21:29 +00:00
sam
6495462157 correct logic that caused beacon frames received in ibss mode to be
discarded when not scanning
2005-01-18 20:07:44 +00:00
sam
07d33c069a move beacon/probe response counting down to after we've decided whether or
not we're going to process the frame; this makes the counters reflect frames
actually processes instead of received (discarded frames were already counted)
2005-01-18 20:04:51 +00:00
sam
4c9a185523 when scanning is interrupted reset state so table entries go in the station
table and not the scan table

Noticed by:	Tai-hwa Liang
2005-01-18 19:59:40 +00:00
sam
5d86ecca9f do fixed rate check when considering if a scan candidate is suitable so when
it's time to join the bss we can't get an error
2005-01-18 19:52:36 +00:00
sam
8af7e8df05 Correct scan candidate selection logic for dual-band devices: prefer
candidate on 5Ghz channel to candidate on 2Ghz channel only when the
rssi are comparable (wasn't considering rssi).
2005-01-01 17:48:27 +00:00
sam
c5bfbdb959 remove netbsd rcsid lines; they are way out of date and we appear to be
diverging too much to make tracking these files worthwhile
2004-12-31 22:44:26 +00:00
sam
14fee97914 bump copyright for 2005 2004-12-31 22:42:38 +00:00
sam
141330c912 fixup inactivity timers:
o ic_inact_auth is a bad name, it's the inactivity threshold
  for being associated but not authorized; use it that way
o reset ni_inact when switching inactivity thresholds to
  minimize the race against the timer (don't want to lock
  for this stuff)
o change the inactivity probe threshold from a one-shot to
  cover a range: when below this threshold but not expired
  send a probe each inactivity interval; should probably
  guard against the interval being turned way down as this
  could cause us to spam the net with probes
2004-12-31 22:05:13 +00:00
sam
7c448457f6 Relearn how WPA keying is supposed to work and fix WPA+WME while
we're at it:
o WPA/802.11i has a unicast key and a group key; in station mode
  everything is sent with the unicast key--we were consulting the
  destination mac address and incorrectly using the group key
o (perpetuate fallback use of the default tx key to maintain
  compatibility with the way wpa_supplicant works)
o correct EAPOL encryption logic to check unicast key instead
  of assuming other state implies this
o move QoS encapsulation up to before enmic work so TKIP has the
  information required to calculate the pseudo-header
o do not do QoS-encapsulation of EAPOL frames as some ap's do the
  wrong thing with such frames (may need to revisit this if ap's
  start dropping non-QoS frames from stations assoc'd with QoS)
o move ieee80211_mbuf_adjust closer to its caller
2004-12-31 21:54:53 +00:00
sam
5a21ccb974 disable default use of wme until we can sort out interoperability issues;
users that want it can explicitly enable it
2004-12-31 21:48:15 +00:00
sam
fe8d9eb613 s/inline/__inline/ 2004-12-31 21:30:42 +00:00
sam
fe545f4516 compare pointers against NULL 2004-12-31 21:28:41 +00:00
sam
bb13d71061 make ap mode sta association debug msg as informative as sta mode 2004-12-31 21:27:53 +00:00
sam
95f27e450d do 11g erp station management in turboG mode too 2004-12-31 21:25:28 +00:00
sam
2cf886f5dc check if the node/station table is already present before creating one; this
can happen on an ibss merge
2004-12-31 21:22:12 +00:00
sam
886afd7287 include phy mode in scan debug msg 2004-12-31 21:19:59 +00:00
sam
e1832f531b accept IEEE80211_KEYIX_NONE for a default tx key 2004-12-31 21:13:35 +00:00
sam
d54bd57731 don't return prematurely from processing a beacon or probe response frame
when associated; this corrects a problem where doing a scan while associated
caused the associated ap to sometimes not be included in the scan set
2004-12-31 21:11:59 +00:00
sam
f249744499 change ieee80211_parse_wmeparams to return a unique value when the ie
is invalid so we can distinguish this from needing a parameter update;
fixes dynamic update of wme parameters
2004-12-31 21:09:43 +00:00
sam
59c07f15bb remove stray \n from debug msg 2004-12-31 21:05:05 +00:00
sam
d5e5ef7858 clear wep bit in 802.11 header after crypto decap so packet
capture doesn't see it
2004-12-31 21:04:05 +00:00
sam
8c3a1cf5aa o add net.wlan.X.driver_caps mib variable for setting the driver capabilities
flags for testing
o debug msg consistency fixups
2004-12-31 21:01:41 +00:00
sam
e508073ee6 correct pseudo-mic header calculation for QoS frames 2004-12-31 20:59:03 +00:00
sam
4327f1ee6e whitespace/debug msg fixups 2004-12-31 20:58:06 +00:00
sam
83e6bc9990 add ieee80211_hdrspace and ieee80211_anyhdrspace to calculate the space
for an ieee80211 header taking into account padding requirements
2004-12-31 20:56:32 +00:00
sam
886a744d99 correct header length calculations on tx path for QoS-encapsulated frames
when IEEE80211_F_DATAPAD is set (e.g. ath); must use ieee80211_hdrspace
instead of ieee80211_hdrsize
2004-12-31 20:51:41 +00:00
sam
0b07314057 const'ify ivp reference 2004-12-31 20:44:15 +00:00
sam
ae02e9bff7 add/fixup debug msgs 2004-12-31 20:42:51 +00:00
sam
dfe3a547e6 s/inline/__inline/ 2004-12-31 20:39:41 +00:00
sam
11042819f1 expose ieee80211_phymode_name for use in debug msgs 2004-12-31 20:38:48 +00:00
sam
dfbb715550 correct module dependency 2004-12-13 18:26:13 +00:00
sam
18549dae69 correct module dependency 2004-12-13 18:12:26 +00:00
sam
e3a33be489 cover up the landmine until there's a proper solution 2004-12-13 04:26:36 +00:00
sam
dc4ceb7b98 do not clear the global key cache when reaching the INIT state 2004-12-12 05:00:13 +00:00
sam
27e1f2c5b3 remove module dependency on rc4; it's not needed any more 2004-12-12 00:28:41 +00:00
sam
42039c0abf fix wep key seting: ENETRESET is the code to return to signal the driver
should push software state to the hardware (was ERESTART which caused the
system call to be retried)

Submitted by:	Tor Egge
2004-12-10 16:35:37 +00:00
sam
0ea4584f3c fixup printf arguments for 64-bit machines 2004-12-08 22:34:07 +00:00
sam
2843bf259e Update 802.11 support; too much new functionality to fully describe
here but it includes completed 802.11g, WPA, 802.11i, 802.1x, WME/WMM,
AP-side power-save, crypto plugin framework, authenticator plugin framework,
and access control plugin frameowrk.
2004-12-08 17:26:47 +00:00
rwatson
b463bc6c33 Add a new network interface flag, IFF_NEEDSGIANT, which will allow
device drivers to declare that the ifp->if_start() method implemented
by the driver requires Giant in order to operate correctly.

Add a 'struct task' to 'struct ifnet' that can be used to execute a
deferred ifp->if_start() in the event that if_start needs to be called
in a Giant-free environment.  To do this, introduce if_start(), a
wrapper function for ifp->if_start().  If the interface can run MPSAFE,
it directly dispatches into the interface start routine.  If it can't
run MPSAFE, we're running with debug.mpsafenet != 0, and Giant isn't
currently held, the task is queued to execute in a swi holding Giant
via if_start_deferred().

Modify if_handoff() to use if_start() instead of direct dispatch.
Modify 802.11 to use if_start() instead of direct dispatch.

This is intended to provide increased compatibility for non-MPSAFE
network device drivers in the presence of Giant-free operation via
asynchronous dispatch.  However, this commit does not mark any network
interfaces as IFF_NEEDSGIANT.
2004-07-27 23:20:45 +00:00
mlaier
977d97b004 Link ALTQ to the build and break with ABI for struct ifnet. Please recompile
your (network) modules as well as any userland that might make sense of
sizeof(struct ifnet).
This does not change the queueing yet. These changes will follow in a
seperate commit. Same with the driver changes, which need case by case
evaluation.

__FreeBSD_version bump will follow.

Tested-by:	(i386)LINT
2004-06-13 17:29:10 +00:00
phk
d6f7d2bde6 Add some missing <sys/module.h> includes which are masked by the
one on death-row in <sys/kernel.h>
2004-05-30 17:57:46 +00:00
andre
f083d45820 Link state change notification of ethernet media to the routing socket.
o The ieee80211_media_status() function updates the ifi_link_state field
  and calls rt_ifmsg() to notify listeners on the routing socket.

Approved by:	sam
2004-05-05 15:48:06 +00:00
sam
534a1c6c21 Resolve the issue of whether frames have FCS or not. Frame data does not
include FCS; if you want to provide it you can put it in the header.

Submitted by:	David Young
2004-04-05 22:13:21 +00:00
sam
95fbaa6dad eliminate nested include by making MALLOC_DECLARE conditional on the
inclusion of <sys/malloc.h>

Submitted by:	bde
2004-04-05 22:10:26 +00:00
sam
4bcffa477a add definitions for WME, WPA (and WPA2), and miscellaneous other stuff
that's coming soon

Obtained from:	madwifi
2004-04-05 17:47:40 +00:00
sam
0eac2dcc6f export the malloc type M_80211_NODE for drivers that override the node
allocation routines
2004-04-05 04:17:03 +00:00
sam
089385e207 make malloc tag for ieee80211_node more recognizable 2004-04-05 04:15:55 +00:00
sam
0a58f658fe Change handling of probe response frames. Previously we always dropped the
refcnt on the node but left it in the node table.  This allows the node table
to hold the results of scanned ap's but for ibss scans left nodes w/o any
driver-private state setup and/or a bad refcnt (when the nodes were timed
out they were prematurely discarded).  Now we treat nodes identified for ap
scanning as before but force nodes discovered when scanning for ibss neighbors
to have complete/proper state and hold the refcnt on the node.  Any other
nodes created because of these frames are discarded directly (need to optimize
this case to eliminate various work that's immediately discarded).
2004-04-02 23:35:24 +00:00
sam
b024266b89 fix adhoc/ibss operation for drivers that require host support (e.g. ath):
o remove IEEE80211_C_RCVMGT capability
o on transmit craft new nodes as needed using new ieee80211_find_txnode routine
o add ieee80211_find_txnode routine to lookup a node by mac address and
  if not present create one when operating in ibss/ahdemo mode; new nodes
  are dup'd from bss and the driver is told to treat the node as if a new
  association has been created so driver-private state (e.g. rate control
  handling) is setup

Obtained from:	netbsd (basic idea)
2004-04-02 23:25:39 +00:00
sam
5c586165c7 always free node reference when processing a probe request frame; was
conditionally doing an unref if operating in adhoc mode which turns
out to be wrong
2004-04-02 23:12:45 +00:00
sam
a1be64a6dc o change ieee80211_dup_bss to inherit explicit data from ic_bss instead of
blindy copying the node contents; this turns out to be a bad idea as we
  add more state in the node for things like WPA
o track node allocation failures in ieee80211_dup_bss instead of the callers

Obtained from:	madwifi
2004-04-02 23:09:24 +00:00
sam
32d170b4b8 track node allocation failure stats in ieee80211_alloc_node instead
of each caller

Obtained from:	madwifi
2004-04-02 23:06:41 +00:00
sam
ddc6548865 replace explicit malloc/free with MALLOC/FREE for portability
Obtained from:	madwifi
2004-04-02 23:02:24 +00:00
sam
aaa98f8e29 extract node matching logic into new ieee80211_match_bss routine for use
in background/incremental scanning

Obtained from:	madwifi
2004-04-02 23:00:30 +00:00
sam
ac53a5bdcf diff reduction against madwifi 2004-04-02 22:56:09 +00:00
sam
f57cb8d81b when processing beacon/probe response frames capture "is probe" in a
variable to improve code legibility since we're going to use it more
in forthcoming mods

Obtained from:	madwifi
2004-04-02 22:54:07 +00:00
sam
41b9a21d19 add a case of IEEE80211_ELEMID_IBSSPARMS so the statistic on unknown
elements is more meaningful (will add more with WPA merge)

Obtained from:	madwifi
2004-04-02 22:50:31 +00:00
sam
b9a1b7eda9 when doing internal bridging free the node instead of just dropping the
reference for consistency (explicit refcounting is discouraged)

Obtained from:	madwifi
2004-04-02 22:48:52 +00:00
sam
ca926004a9 when receiving a frame w/ a bad version number don't unref the node; the
driver is responsible for that

Obtained from:	madwifi
2004-04-02 22:47:11 +00:00
sam
4cfcf755a1 insure basic rate bit is set in derived rate set; this
works around a protocol/firmware problem with some versions found
in hermes/prism cards
2004-04-02 20:22:25 +00:00
sam
d007eaede6 diff reduction against madwifi/p4 2004-04-02 20:19:20 +00:00
sam
2f7d679f76 o add support for controlling the power of transmitted frames
o add support for controlling the 11g protection mechanism used
  to protect OFDM frames in a mixed 11b/g network

Reviewed by:	imp
2004-03-30 22:57:57 +00:00
sam
551dbe5269 Only call if_init when doing SIOCSIFADDR if the interface is not marked
up (IFF_UP).  This eliminates extraneous AP scanning.

Reviewed by:	imp
2004-03-30 22:53:52 +00:00
mux
3ca8d2f211 Add explicit dependency on "ether", since we use ether_ifattach(). 2004-03-16 19:25:55 +00:00
onoe
8fb32b2573 Change WI_RID_SCAN_RES compatibility interface to return the result after
active scan is completed just as WI_RID_READ_APS.
This fixes wicontrol -L for ath(4) and awi(4) to have results even if
the driver cannot associate any APs.
2004-01-19 05:25:43 +00:00
onoe
df98da69f8 Add support for FH phy, which will be used by awi driver.
Also some if_media constants to indicate operational mode are changed
to bitmasks to reduce diffs from NetBSD.
2004-01-15 08:44:27 +00:00
sam
b8570d5db4 Handle SIOCSIFMTU ioctl directly so we can apply 802.11-specific bounds.
Note that the min is actually constrained to IF_MINMTU by the if layer.
2004-01-13 06:22:55 +00:00
sam
189a9001bd Sync with netbsd:
o #ifdef _KERNEL the fallback definition for DLT_IEEE802_11_RADIO
o fix many comments
o rename antenna stuff and fix units/reference signal
o change IEEE80211_RADIOTAP_DBM_TX_POWER from unsigned 16-bit value
  to a signed 8-bit value
o change IEEE80211_RADIOTAP_FLAGS from 16 bits to 8 bits to simplify
  padding requirements
o drop IEEE80211_RADIOTAP_TIME
o change IEEE80211_RADIOTAP_ANTENNA from 16 bits to 8 bits
o drop IEEE80211_RADIOTAP_PAD
o add channel flag definitions for outside the kernel so radiotap
  doesn't depend on stuff in ieee80211*.h

Obtained from:	NetBSD
2003-12-28 06:57:28 +00:00
sam
5bfac52170 o insure the current channel is in a good state before starting an AP scan
o reject scan requests for a device that isn't marked up

This fixes a problem where requesting a scan before marking the device
up would cause a panic because the current channel was set to "any" (0xffff).
2003-11-13 05:23:58 +00:00
sam
02ea9f180f fix typo that broke AP scanning by BSSID
Submitted by:	Len Widra
2003-11-09 23:36:46 +00:00
green
932794c27c Fix a reversed suser(9) in SIOCG80211:IEEE80211_IOC_WEPKEY which prevents
root from reading the wireless card's WEP keys, but allows non-root.
2003-11-05 04:16:48 +00:00
brooks
f1e94c6f29 Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
sam
68dcd813b1 fix station mode breakage (repeat after me: "test every change, no
matter how small...")
2003-10-17 23:59:11 +00:00
sam
eefb2fc9e8 add statistics for all failures and/or abnormal events; still need
to add per-node statistics
2003-10-17 23:15:30 +00:00
sam
a6b5975f25 fixup debug msgs 2003-10-17 22:15:26 +00:00
sam
45942b2f20 include FH/DS parameters element in probe response frames 2003-10-17 22:09:20 +00:00
sam
23522eb855 correct comment 2003-10-17 21:56:42 +00:00
sam
98b46f244c o add capability to indicate if device receives all management frames
o use recv mgmt capability to decide if outbound frames should be
  discarded if no node table entry is present
2003-10-17 21:54:59 +00:00
sam
365e4629ed parameterize locking to improve portability and possible
change to different locking strategies
2003-10-17 21:41:52 +00:00
sam
04780f09b9 Try yet again to deal with timing out nodes. We cannot hold the
node lock while sending a management frame as this will potentially
result in a LOR with a driver lock.  This doesn't happen for the
Atheros driver but does for the wi driver.  Use a generation number
to help process each node once when scanning the node table and
drop the node lock if we need to timeout a node and send a frame.
2003-09-26 17:00:44 +00:00
sam
d39b84f6ea Correct rate set negotiation when operating as a station: if the
AP has basic rates that we do not support then ignore them instead
of marking the rate set in error.

This fixes an 11b station associating with an 11g/b AP.
2003-09-26 16:54:55 +00:00
sam
22bdcdfcee allocate node table entries with a specific malloc type 2003-09-26 16:52:12 +00:00
sam
19d2ca15c6 correct spelling of IEEE80211_IOC_RTSTHRESHOLD 2003-09-26 16:48:39 +00:00
sam
c9c933e78b Generalize the per-node RSSI data so drivers can do more interesting
things than record a single value.

o add a per-node method for returning the "current RSSI" for a node
o create a default method that returns ni_rssi which is the rssi for
  the last received frame
o use the per-node "get rssi" method to return data for the RID's
  submitted by wicontrol, et. al.

Loosely based on work by Tom Marshall <tommy@home.tig-grr.com> for MADWIFI.
2003-09-15 22:28:07 +00:00
sam
53c5407126 Change input handling to not expect drivers to filter short frames.
In particular, let drivers send up control frames so we can dispatch
them to bpf in monitor mode.

This is the first (small) step to adding more functionality such as
power save mode.
2003-09-15 19:38:29 +00:00
sam
3606409512 add definitions for various control frames and a minimum-sized frame that
we use to define IEEE80211_MIN_LEN; the minimal length for frames drivers
may pass up into the 802.11 layer
2003-09-15 19:36:34 +00:00
sam
73b49f3a66 Honor the short preamble capability/state flag when calculating the
capabilities for outbound management frames.  But beware of sending
this when operating on 5GHz channels; some 11a AP's reject association
requests if this bit is set in the capabilities listed.

Obtained from:	MADWIFI (with modifications)
2003-09-14 22:34:24 +00:00
sam
ecc9826d1b short preamble capability is not just for 11g; mark IEEE80211_F_SHPREAMBLE
regardless of the operating mode

Obtained from:	MADWIFI
2003-09-14 22:32:18 +00:00
sam
bdc819fefb Experimental bpf capture format for 802.11 devices. The link layer
type belongs in net/bpf.h but we keep it here for the moment.

P:
Submittep by:
Obtained from:	David Young <dyoung@pobox.com>
2003-09-05 22:19:32 +00:00
sam
0ff5af9151 o correct logic that checks frame size to decide if a cluaster is needed
o add an assertion to check the max possible packet size

Noticed by:	David Young <dyoung@pobox.com>
2003-09-01 02:55:09 +00:00
sam
1c1194250d MFp4 changes to fix locking issues and correct reference
count handling of station entries in hostap mode:

Input path:

o driver is now expected to find the node associated with the
  sender of a received frame; use ic_bss if none is located
o driver passes the (referenced) node into ieee80211_input for
  use within the wlan module and is responsible for cleaning up
  on return
o the antenna state is no longer passed up with each frame; this
  is now considered driver-private state and drivers are responsible
  for keeping it in the driver-private part of a node

Output path:

Revamp output path for management frames to eliminate redundant
locking that causes problems and to correct reference counting
bogosity that occurs when stations are timed out due to inactivity
(in AP mode).  On output the refcnt'd node is stashed in the pkthdr's
recvif field (yech) and retrieved by the driver.  This eliminates
an unref/ref scenario and related node table unlock/lock due to the
driver looking up the node.  This is particularly important when
stations are timed out as this causes a lock order reversal that
can result in a deadlock.  As a byproduct we also reduce the overhead
for sending management frames (minimal).  Additional fallout from
this is a change to ieee80211_encap to return a refcn't node for
tieing to the outbound frame.  Node refcnts are not reclaimed until
after a frame is completely processed (e.g. in the tx interrupt
handler).  This is especially important for timed out stations as
this deref will be the final one causing the node entry to be
reclaimed.

Additional semi-related changes:
o replace m_copym use with m_copypacket (optimization)
o add assert to verify ic_bss is never free'd during normal operation
o add comments explaining calling conventions by drivers for frames
  going in each direction
o remove extraneous code that "cannot be executed" (e.g. because
  pointers may never be null)
2003-08-19 22:17:04 +00:00
sam
af81e4b88b Delay creating ic_bss until after the super-class has a chance
to override the method pointers for manipulating nodes; this fixes
a problem where the ic_bss node was not being created properly
for the ath driver causing the driver to scribble on random memory.

Noticed by:	David Young <dyoung@pobox.com>
2003-08-13 22:09:44 +00:00
sam
e588332388 Use IEEE80211_RATE_MAXSIZE instead of IEEE80211_RATE_SIZE to validate the
rate set element id from an AP.  This allows stations to associate with
AP's that violate the 802.11 spec by sending >8 rates.  This corrects a
recent regression; older code did likewise.
2003-08-13 21:49:35 +00:00
sam
7629ee78c2 add monitor mode 2003-07-21 02:49:42 +00:00
sam
51c8bf1aeb o change ieee80211_new_state handling to use a proper method that drivers
override in their sub-class; this eliminates the hack of interpreting the
  EINPROGRESS return value to mean "don't do any of the normal work"
o correct active scanning so the first channel is only scanned once and so
  per-channel passive mode is properly honored
o expose 802.11 FSM state names so every driver doesn't keep a private copy
o eliminate node parameter to ieee80211_begin_scan; it was not being used
2003-07-20 21:36:08 +00:00
sam
c0ad98bb7c insure ic_bss always has a "valid" channel; avoids problems where users could
query the state of a card and find a null channel since allocating the node
left ni_chan zero
2003-06-29 20:13:38 +00:00
sam
709e58cfa7 use proper length to copy data for WI_RID_DESIRED_SSID (was smashing
ic_des_chan that immediately follows)
2003-06-29 20:12:17 +00:00
sam
1fb2cade2b add safeguard against (bogus) null channel parameter 2003-06-29 20:10:54 +00:00
sam
350cc1a8b5 revise copyright notices per discussion with Atsushi Onoe <onoe@sm.sony.co.jp> 2003-06-27 05:13:52 +00:00