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.
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.
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.
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).
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.
(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.
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.
* 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.
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.
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.
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()....
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.
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.
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.
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.)