Commit Graph

46 Commits

Author SHA1 Message Date
Sam Leffler
41b3c790eb First cut at half/quarter-rate 11a channel support (e.g. for use
in the Public Safety Band):
o add channel flags to identify half/quarter-rate operation
o add rate sets (need to check spec on 4Mb/s in 1/4 rate)
o add if_media definitions for new rates
o split net80211 channel setup out into ieee80211_chan_init
o fixup ieee80211_mhz2ieee and ieee80211_ieee2mhz to understand half/quarter
  rate channels: note we temporarily use a nonstandard/hack numbering that
  avoids overlap with 2.4G channels because we don't (yet) have enough
  state to identify and/or map overlapping channel sets
o fixup ieee80211_ifmedia_init so it can be called post attach and will
  recalculate the channel list and associated state; this enables changing
  channel-related state like the regulatory domain after attach (will be
  needed for 802.11d support too)
o add ieee80211_get_suprates to return a reference to the supported rate
  set for a given channel
o add 3, 4.5, and 27 MB/s tx rates to rate <-> media conversion routines
o const-poison channel arg to ieee80211_chan2mode
2006-12-27 18:46:18 +00:00
Sam Leffler
ab96db105f back out use of LLC_SNAPFRAMELEN now that sizeof(struct llc) isn't
padded on arm
2006-12-01 17:58:33 +00:00
Sam Leffler
8c86f43df4 sizeof(struct llc) includes padding on arm; use LLC_SNAPFRAMELEN for now
Submitted by:	jhay
MFC after:	2 weeks
2006-12-01 05:48:35 +00:00
Andre Oppermann
78ba57b9e1 Move ethernet VLAN tags from mtags to its own mbuf packet header field
m_pkthdr.ether_vlan.  The presence of the M_VLANTAG flag on the mbuf
signifies the presence and validity of its content.

Drivers that support hardware VLAN tag stripping fill in the received
VLAN tag (containing both vlan and priority information) into the
ether_vtag mbuf packet header field:

	m->m_pkthdr.ether_vtag = vlan_id;	/* ntohs()? */
	m->m_flags |= M_VLANTAG;

to mark the packet m with the specified VLAN tag.

On output the driver should check the mbuf for the M_VLANTAG flag to
see if a VLAN tag is present and valid:

	if (m->m_flags & M_VLANTAG) {
		... = m->m_pkthdr.ether_vtag;	/* htons()? */
		... pass tag to hardware ...
	}

VLAN tags are stored in host byte order.  Byte swapping may be necessary.

(Note: This driver conversion was mechanic and did not add or remove any
byte swapping in the drivers.)

Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition.  No more tag
memory allocation have to be done.

Reviewed by:	thompsa, yar
Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-09-17 13:33:30 +00:00
Sam Leffler
b6e9b119a2 add per-sta ucast/mcast stats
MFC after:	1 week
2006-08-10 05:37:49 +00:00
Sam Leffler
246b546762 add support for 802.11 packet injection via bpf
Together with:	Andrea Bittau <a.bittau@cs.ucl.ac.uk>
Reviewed by:	arch@
MFC after:	1 month
2006-07-26 03:15:16 +00:00
Sam Leffler
83a244dbe0 when doing s/w crypto make sure work is done w/ a writable mbuf chain;
this corrects problems with drivers that rely on the host to do
crypto (iwi, ipw, ral, ural, wi (hostap), awi)

Hard work by:	luigi, mlaier
Reviewed by:	luigi, mlaier
MFC after:	1 week
2006-03-15 21:27:08 +00:00
Sam Leffler
667dad55fc consolidate calculation of capabilities ie
Reviewed by:	avatar
MFC after:	2 weeks
2006-02-25 05:36:43 +00:00
Sam Leffler
6d049ab343 set the mgt frame tx timer before dispatching the frame to the
driver; this closes a race where a response could be processed
before the timer was started and cause a RUN->SCAN state change
when operating in station mode

Reviewed by:	avatar, dyoung
MFC after:	1 week
2006-02-08 17:30:31 +00:00
Sam Leffler
0912bac9b3 update erp information element in the beacon frame to reflect
changes in the bss

Reviewed by:	avatar
Obtained from:	atheros
MFC after:	2 weeks
2006-01-02 16:57:20 +00:00
Sam Leffler
a196b35f08 correct handling of dtim for periods > 1
Obtained from:	madwifi
2005-12-05 22:14:13 +00:00
Andre Oppermann
34333b16cd Retire MT_HEADER mbuf type and change its users to use MT_DATA.
Having an additional MT_HEADER mbuf type is superfluous and redundant
as nothing depends on it.  It only adds a layer of confusion.  The
distinction between header mbuf's and data mbuf's is solely done
through the m->m_flags M_PKTHDR flag.

Non-native code is not changed in this commit.  For compatibility
MT_HEADER is mapped to MT_DATA.

Sponsored by:	TCP/IP Optimization Fundraise 2005
2005-11-02 13:46:32 +00:00
Sam Leffler
b5c9941514 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-10 16:22:30 +00:00
Sam Leffler
d365f9c760 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 Leffler
19ad2dd79a 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 Leffler
af8418dcb1 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 Leffler
add59d0875 split 802.11 frame xmit setup code into ieee80211_send_setup
MFC after:	3 days
2005-07-22 20:48:11 +00:00
Sam Leffler
edfa57d0f0 simplify tim callback api
MFC after:	3 days
2005-07-22 17:45:48 +00:00
Sam Leffler
e4918ecdb9 simplify ieee80211_node_authorize and ieee80211_node_unauthorize api's
MFC after:	3 days
2005-07-22 17:36:12 +00:00
Sam Leffler
f62121ce8e simplifiy ieee80211_send_nulldata api
MFC after:	3 days
2005-07-22 17:31:18 +00:00
Sam Leffler
bc5627d91f 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 Leffler
da17aba102 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 Leffler
6aa57182d3 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 Leffler
96d8846397 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 Leffler
d6ec172c3a 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 Leffler
bd40429e3d correct comparison for null ptr
Noticed by:	Coverity Prevent analysis tool
2005-03-16 20:42:00 +00:00
Sam Leffler
b4b64678d0 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 Leffler
cb212bbc75 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 Leffler
49a152366e 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 Leffler
5aa17efa69 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 Leffler
a8b16e8727 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 Leffler
1f1d781074 bump copyright for 2005 2004-12-31 22:42:38 +00:00
Sam Leffler
5e923d2ebd 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 Leffler
1657488232 fixup printf arguments for 64-bit machines 2004-12-08 22:34:07 +00:00
Sam Leffler
8a1b9b6ad4 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
Robert Watson
af5e59bf28 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
Sam Leffler
750d6d0c60 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 Leffler
1be50176db 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 Leffler
b83d21129e include FH/DS parameters element in probe response frames 2003-10-17 22:09:20 +00:00
Sam Leffler
7f7ecba47e 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 Leffler
4f2e09c4b2 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 Leffler
7997bcbc55 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 Leffler
0a915fad5d 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 Leffler
2bbe529d9c add monitor mode 2003-07-21 02:49:42 +00:00
Sam Leffler
7535e66acd revise copyright notices per discussion with Atsushi Onoe <onoe@sm.sony.co.jp> 2003-06-27 05:13:52 +00:00
Sam Leffler
1a1e1d2157 new 802.11 layer:
o code reorg (relative to old netbsd-derived code) for future growth
o drivers now specify available channels and rates and 802.11 layer handles
  almost all ifmedia actions
o multi-mode support for 11a/b/g devices
o 11g protocol additions (incomplete)
o new element id additions (for other than 11g)
o node/station table redone for proper locking and to eliminate driver
  incestuousness
o split device flags and capabilities to reduce confusion and provide room
  for expansion
o incomplete power management infrastructure (need to revisit)
o incomplete hooks for software retry
o more...
2003-06-23 16:55:01 +00:00