create and queue a new one that carries the new BSSID. I mined
net80211 in FreeBSD for the solution, which is to make an
IEEE80211_S_RUN->IEEE80211_S_RUN state transition---ath_newstate
discards the old beacon packet creates a new one by calling
ath_beacon_alloc.
I tested the merge as follows. Starting at my desk on the second
floor of the building where I work:
soekris% ifconfig ath0 mediaopt adhoc ssid zzz chan 11 down
powerbook% ifconfig rtw0 mediaopt adhoc ssid zzz chan 11 up
soekris% sleep 25; ifconfig ath0 up
I raced to the elevator with my Powerbook, pressed the "Down"
button, got in, and pressed "Floor 1." At the first floor:
powerbook% ifconfig rtw0 | grep bssid
bssid 02:p:p:p:p:p chan 11
I waited 25 seconds. I pressed "Floor 2." At Floor 2, I returned to my desk.
I checked to make sure that the Soekris console read:
soekris% ath0: creating bss 02:s:s:s:s:s
ath0: bss merge 02:s:s:s:s:s -> 02:p:p:p:p:p
0:s:s:s:s:s is the Soekris' WLAN MAC. 0:p:p:p:p:p is the Powerbook's
WLAN MAC. Each created an ad hoc-mode BSSID from its WLAN MAC by
OR'ing 0x2 with the first octet.
My Powerbook created a network while the Soekris radio was off.
The Soekris radio turned on while I was in the 802.11-impervious
elevator with my Powerbook. When I returned to the second floor,
the Soekris "heard" beacons from my Powerbook as the elevator door
opened. Since the Powerbook's network was approximately 25 seconds
older than the Soekris', and since it had the same SSID (zzz) as
the Soekris', the Soekris merged with the Powerbook's network (by
setting its BSSID) as it should.
(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.
"power-off NIC" function, by adding a 'disable' argument to ath_stop.
Pass disable=0 to ath_stop() at the top of ath_init, so that we
don't power-off the Cardbus slot before resetting the HAL. Thanks
to Greg Troxel for his analysis of this bug.
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.
completely. In particular, accept them in monitor mode (where we generally
aren't doing anything unless we're in promiscuous mode anyway) and host-AP
mode (where we want to see neighbor APs).
FreeBSD commit log:
----------------------------
use correct malloc type to allocate struct ieee80211_node's
Noticed by: phk
----------------------------
do proper subclassing of node free+copy; the previous hack falls apart when
the 802.11 layer does useful work
Obtained from: madwifi
----------------------------
transmit beacon frames directly instead of defering them to a swi; there
was too much delay
Obtained from: madwifi
----------------------------
update copyright notice for 2004
----------------------------
check more quickly (and directly) if an interrupt is pending; this reduces
work done in ath_intr when the irq is shared
Obtained from: madwifi
----------------------------
cleanup descriptor allocation if attach fails
Obtained from: madwifi
----------------------------
remove use IEEE80211_C_RCVMGT
----------------------------
radiotap updates:
o force little-endian byte order for header
o pad header to 32-bit boundary to guard against applications that assume
packet data alignment
----------------------------
Don't announce MAC addresses twice.
(ieee80211_ifattach() calls ether_ifattach().)
----------------------------
Make this compile on amd64.
"I'll cope" by: sam
----------------------------
When draining the tx queue reclaim any node references held in packets.
This fixes a problem when operating as an AP where clients would get
stuck in the node table because the reference count never went to zero.
----------------------------
When ath_hal_stoptxdma returns an error dma is still likely stopped
so don't just stop trying to send a beacon frame or we'll be more likely
to lose sync. This only seems to happen on some older chips.
----------------------------
use ath_reset instead of ath_init when recovering from a watchdog timeout:
resetting the hardware is sufficient, no need to reset the 802.11 fsm
----------------------------
make hw.ath.debug a tunable
----------------------------
make hw.ath.outdoor and hw.ath.countrycode tunables
----------------------------
split debugging messages up into classes;
ah_debug is now treated as a bit vector
----------------------------
update radiotap support to reflect recent changes:
o move tx taps from ath_start to ath_tx_start so lots more
state is available to tap
o add tx flags
o add tx rate
o add tx power (constant for the moment)
o add tx antenna state
----------------------------
o eliminate widespread on-stack mbuf use for bpf by introducing
a new bpf_mtap2 routine that does the right thing for an mbuf
and a variable-length chunk of data that should be prepended.
o while we're sweeping the drivers, use u_int32_t uniformly when
when prepending the address family (several places were assuming
sizeof(int) was 4)
o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated
mbufs have been eliminated; this may better be moved to the bpf
routines
(tightly scoped) reason for recording the node address by recording
the assigned number. Dink pci/if_bge.c to match, since ic/ath.c was
used as the archetype.
* add constants to enums
* HAL update: stops panics, fixes ad hoc-mode beacons, some API
changes
* get and use mac/phy/rf front-end revision codes
* add a custom ath(4) ic_node_getrssi callback which does RSSI
averaging
* do not immediately scan, but re-associate after missing beacons.
* bug fix: don't if_init after detach.
* HAL diagnostics ioctl, SIOCGATHDIAG
* send DS parameters element in beacons
* const-ify some pointers
* consolidate rx-filter settings into ath_calcrxfilter
* abstract FreeBSD `ticks', NetBSD `hardclock_ticks' with ATH_TICKS()
* misc. other changes
the number of descriptors, because of a disparity between the
bus_dmamap_load_mbuf implementation in FreeBSD and NetBSD. Now I
cover up the difference using ath_dmamap_load_mbuf.
Thanks Enami Tsugutomo for diagnosing this.