Commit Graph

168 Commits

Author SHA1 Message Date
dyoung 5d0039996f Synchronize ieee80211_find_vap, ieee80211_find_instance. 2005-07-11 17:15:30 +00:00
dyoung 9e9d2907ec Cosmetic: reunite a comment with the code it describes. 2005-07-10 08:12:50 +00:00
dyoung 0e4587ae92 Bug fix: reset saw_bss when we start iterating over a new interface's
nodes, so that we list every interface's ic_bss node, instead of
listing only the first interface's.
2005-07-10 08:11:40 +00:00
dyoung 707b2b4ae1 Avoid an unnecessary API difference between NetBSD and FreeBSD:
back out my change to ieee80211_crypto_encap that made it free its
mbuf argument on error.  I had thought it was a bug.  It was not.
It's the drivers that are broken.  Make an(4), atw(4), ipw(4),
iwi(4), ral(4), rtw(4), ural(4), and wi(4) free the mbuf when
ieee80211_crypto_encap returns NULL.  Also, return ath(4) to the
way it was---i.e., free the mbuf.

Thanks to Sam Leffler to pointing out my mistake.
2005-07-06 23:44:15 +00:00
he 053b017df8 Wrap use of MALLOC_DECLARE() within an #ifdef _KERNEL, it's declaration
in sys/mallocvar.h is within a similar conditional.
Fixes build problem for vax.
2005-07-05 23:04:14 +00:00
dyoung 83285d3445 In ieee80211_refine_node_for_beacon, do not decrease the reference
count on the node that is passed in, because it belongs to the
driver.  Also, do not increase the reference count on the refined
node, because ieee80211_refine_node_for_beacon's caller (ieee80211_input)
will never decrease the reference count.

As a general rule, reference counts are used for driver code to
assert ownership of ieee80211_nodes that are shared by the driver
and net80211 layer.
2005-07-05 19:56:04 +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 c511c45965 Don't load the ic_bss node into the sysctl result twice, as we
would do in IBSS mode if the ic_bss had not expired from the
scan/neighbor node-table.
2005-07-03 20:44:46 +00:00
dyoung c0a74e44c8 rtw: Try to get hardware WEP to work. It seems to work in
the RX direction, but not in the TX direction.  The
	  net80211 crypto framework doesn't seem to cope very well
	  with the assymetry (I'm probably missing something), so
	  I will use software WEP for now.

net80211: In ieee80211_compute_duration, figure out whether to add
	  the WEP header to the packet overhead by checking the
	  WEP bit in the Frame Control field of the 802.11 header,
	  instead of checking the IEEE80211_F_PRIVACY flag.

	  Also, if the WEP bit is present, assume that the frame
	  described by (wh, len) has already already been WEP
	  encapsulated, and adjust the payload length accordingly.
	  XXX that's a grotty hack that I will have to revisit,
	  later.
2005-06-27 05:49:13 +00:00
erh 1b6f9cc263 Make sure there is a valid transmit key, before trying to use information
about it.  Fixes a crash when configuring wi0.
2005-06-26 21:51:37 +00:00
dyoung 9a7ebfdde9 Add some debug messages to ieee80211_notify_node_{join,leave}.
Change the way we walk 802.11 peers/clients: for each eligible
interface, walk the ic_sta (peers/clients) table, first; walk the
ic_scan (scan results) table, second; then visit the ic_bss (node
for the network joined/created by the interface).
2005-06-26 04:34:43 +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
martin adc4b94498 Remove unused <atomic.h> include; add <sys/device.h> includes where
needed.
2005-06-22 22:07:48 +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
dyoung 3cdc4fcd5f Import FreeBSD's net80211(9) of 2005-05-18 2005-06-21 20:37:38 +00:00
atatat df13e3579e Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone.  Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
2005-06-20 02:49:18 +00:00
atatat 420d91208b Properly fix the constipated lossage wrt -Wcast-qual and the sysctl
code.  I know it's not the prettiest code, but it seems to work rather
well in spite of itself.
2005-06-09 02:19:59 +00:00
christos b71716c913 Unconst sysctl_query... hi atatat 2005-05-30 04:16:56 +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 89e3661699 Bug fix: when encapsulating 802.11 data packets, always copy the
BSS node's BSSID into the frame header.  It is incorrect to copy
in the neighbor's BSSID because it may be out of date following an
IBSS merge.
2005-01-21 22:57:30 +00:00
dyoung 07a485e480 Cosmetic: shorten a staircase. 2005-01-16 11:37:58 +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 4c03aed52f In ieee80211_getmbuf, remove the #ifdef __FreeBSD__ code. Check
for MCLGET success using the (m->m_flags & M_EXT) idiom.
2005-01-04 00:36:18 +00:00
dyoung eeb33155cd Fix a typo. 2005-01-04 00:34:58 +00:00
dyoung 45d5300ab2 Cosmetic: remove some dead code. Join some lines. 2004-12-27 10:47:57 +00:00
dyoung 07e67ea7d6 802.11 Control/multicast/broadcast packets are not acknowledged.
Set a shorter 802.11 Duration field, accordingly.

XXX We expect CTS/ACK at 1 Mb/s for 1 & 2 Mb/s stations; and CTS/ACK
at 2 Mb/s for 5.5 & 11 Mb/s stations.  We need to check with the
802.11 standard.  Rate negotiation may need to be overhauld for
standards compliance, too.
2004-12-27 09:25:05 +00:00
mycroft 1989546a4c GC unused stuff. 2004-12-27 05:36:08 +00:00
mycroft e3c9106a08 Simplify the duration calculations somewhat.
* Add an intermediate variable, ctsrate, which is currently derived directly
 from rate, but may be handled differently later (especially for 11g).
* Assume ACKs are sent at the same rate as the original data packet, as ath
  does, shortening the ACK reservation time substantially.
* Add a note that we need to deal with not adding the ACK time for some
  packets, though this is not implemented yet.

Questions:
* How do we affect the control rate used to send RTS/CTS packets?
* Is the PLCP header length actually controlled by the preamble length
  selection, or should this be based on the transmit rate?

Of course short preamble is not actually implemented/working yet.
2004-12-27 05:35:33 +00:00
mycroft 9fc969bfcb Update a comment. 2004-12-27 01:57:58 +00:00
mycroft 06e4fe7f62 Replace d_plcp_svc with d_residue. The latter is the number of whole
empty/unused octets to fill out the data time slot.  The value is constrained
by math to 0 for <= 5.5Mb, 0-1 for 11Mb, and 0-2 for 22Mb.  It is used to
signal to the MAC that there is residue.
2004-12-27 01:51:49 +00:00
dyoung 24ba04b962 Fix a bug in ieee80211_compute_duration: the 802.11 Duration field
in an 802.11 unicast data packet is equal to the duration of the
SIFS and Acknowledgement.  That is, the amount of time reserved
*after* the packet has finished transmitting.

Change the arguments to ieee80211_compute_duration: pass the entire
packet length, not just the payload length.  Add a 'debug' argument
to ieee80211_compute_duration and its helper subroutine,
ieee80211_compute_duration1.

If debug != 0, ieee80211_compute_duration printfs its arguments
and several local variables.

In rtw(4), load the 802.11 Duration field with the result from
ieee80211_compute_duration.
2004-12-23 06:08:52 +00:00
dyoung 8828aae46c #define the difference in microseconds between a fast and a slow
preamble and PLCP header.
2004-12-23 05:25:41 +00:00
dyoung 8fff1555a5 Add SIOCG80211ZSTATS to atomically get/clear 802.11 statistics.
Protect SIOCG80211STATS with splnet()/splx() so that it takes a
"snapshot" of the 802.11 statistics, which is superfluous if
ieee80211_ioctl is always called at splnet()....
2004-12-20 23:03:39 +00:00
dyoung 81eefc6f1a Define for more bits in the Service field of the 802.11 PLCP Header.
For use by the subroutine ieee80211_compute_duration, add struct
ieee80211_duration, and #define a number of microsecond constants
used for the transmit timing of 802.11 packets.

Add the subroutine ieee80211_compute_duration, which computes for
any packet the appropriate 802.11 Duration field, the PLCP Length
field, as well as the Duration and Length fields for an RTS frame.

atw(4), rtw(4), future drivers, and possibly ath(4) will share
ieee80211_compute_duration.
2004-12-19 08:08:06 +00:00
dyoung 49cfbd0442 Drivers are not expected to call ieee80211_find_node_for_beacon,
so don't increase the reference count on a node before returning
it.
2004-10-04 07:35:48 +00:00
dyoung b01c9a3223 Bug fix: in ieee80211_find_txnode, we used to call ieee80211_ref_node(ni)
if ni == NULL and the operating mode was not "ad hoc" or "ad hoc
demo."  That crashed the kernel.  Now, if the operating mode is
not "ad hoc (demo)," and ni == NULL, return NULL right away.

Also, if ieee80211_dup_bss returns NULL, return NULL right away.
This doesn't fix a bug, but it makes clear how this works.
2004-10-04 07:17:41 +00:00
enami a4ee532ba4 Adjust caller for net/if_ieee80211subr.c rev 1.11 change; the argument
`reassoc' is replaced with testing if the type is ..._REASSOC_REQ.
2004-09-07 01:07:40 +00:00
dyoung 90691ca787 Cosmetic: remove extraneous blank line. 2004-08-10 21:58:31 +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 2a134a8f3c Change the basic rate list for 11g to contain just the 11b modes, mimicking the
behavior of other systems.
2004-07-30 17:05:18 +00:00
dyoung 59380646e3 For interoperability with legacy equipment, do not enable short
preamble by default.
2004-07-30 04:32:10 +00:00
dyoung 8205ae2288 Change sysctl range-checking: net.link.ieee80211.debug values are
now 0x0 -> 0xffffffff, not 0 -> 2.
2004-07-30 04:29:52 +00:00
mycroft 198c3a9495 Whoops, rearrange the function so the TAILQ_EMPTY() DTRT. 2004-07-29 23:17:29 +00:00
mycroft 3fbc463c40 Don't reset the inactivity timer every time we create a node -- this could
cause us to stall and never time out anything.
2004-07-29 22:59:19 +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