2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * Alternatively, this software may be distributed under the terms of the
18 * GNU General Public License ("GPL") version 2 as published by the Free
19 * Software Foundation.
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * $FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.22 2004/04/05 04:15:55 sam Exp $
33 * $DragonFly: src/sys/netproto/802_11/Attic/ieee80211_node.c,v 1.1 2004/07/26 16:30:17 joerg Exp $
38 #include <sys/param.h>
39 #include <sys/systm.h>
41 #include <sys/malloc.h>
42 #include <sys/kernel.h>
43 #include <sys/socket.h>
44 #include <sys/sockio.h>
45 #include <sys/endian.h>
46 #include <sys/errno.h>
49 #include <sys/sysctl.h>
50 #include <sys/thread.h>
51 #include <sys/thread2.h>
53 #include <machine/atomic.h>
56 #include <net/if_dl.h>
57 #include <net/if_media.h>
58 #include <net/if_arp.h>
59 #include <net/ethernet.h>
60 #include <net/if_llc.h>
62 #include <netproto/802_11/ieee80211_var.h>
67 #include <netinet/in.h>
68 #include <netinet/if_ether.h>
71 static struct ieee80211_node *ieee80211_node_alloc(struct ieee80211com *);
72 static void ieee80211_node_free(struct ieee80211com *, struct ieee80211_node *);
73 static void ieee80211_node_copy(struct ieee80211com *,
74 struct ieee80211_node *, const struct ieee80211_node *);
75 static uint8_t ieee80211_node_getrssi(struct ieee80211com *,
76 struct ieee80211_node *);
78 static void ieee80211_setup_node(struct ieee80211com *ic,
79 struct ieee80211_node *ni, uint8_t *macaddr);
80 static void _ieee80211_free_node(struct ieee80211com *,
81 struct ieee80211_node *);
83 MALLOC_DEFINE(M_80211_NODE, "80211node", "802.11 node state");
86 ieee80211_node_attach(struct ifnet *ifp)
88 struct ieee80211com *ic = (void *)ifp;
90 lwkt_token_init(&ic->ic_nodetoken);
91 TAILQ_INIT(&ic->ic_node);
92 ic->ic_node_alloc = ieee80211_node_alloc;
93 ic->ic_node_free = ieee80211_node_free;
94 ic->ic_node_copy = ieee80211_node_copy;
95 ic->ic_node_getrssi = ieee80211_node_getrssi;
100 ieee80211_node_lateattach(struct ifnet *ifp)
102 struct ieee80211com *ic = (void *)ifp;
103 struct ieee80211_node *ni;
105 ni = (*ic->ic_node_alloc)(ic);
106 KASSERT(ni != NULL, ("unable to setup inital BSS node"));
107 ni->ni_chan = IEEE80211_CHAN_ANYC;
109 ic->ic_txpower = IEEE80211_TXPOWER_MAX;
113 ieee80211_node_detach(struct ifnet *ifp)
115 struct ieee80211com *ic = (void *)ifp;
117 if (ic->ic_bss != NULL)
118 (*ic->ic_node_free)(ic, ic->ic_bss);
119 ieee80211_free_allnodes(ic);
120 lwkt_token_uninit(&ic->ic_nodetoken);
124 * AP scanning support.
128 * Initialize the active channel set based on the set
129 * of available channels and the current PHY mode.
132 ieee80211_reset_scan(struct ifnet *ifp)
134 struct ieee80211com *ic = (void *)ifp;
136 memcpy(ic->ic_chan_scan, ic->ic_chan_active,
137 sizeof(ic->ic_chan_active));
138 /* NB: hack, setup so next_scan starts with the first channel */
139 if (ic->ic_bss->ni_chan == IEEE80211_CHAN_ANYC)
140 ic->ic_bss->ni_chan = &ic->ic_channels[IEEE80211_CHAN_MAX];
144 * Begin an active scan.
147 ieee80211_begin_scan(struct ifnet *ifp)
149 struct ieee80211com *ic = (void *)ifp;
152 * In all but hostap mode scanning starts off in
153 * an active mode before switching to passive.
155 if (ic->ic_opmode != IEEE80211_M_HOSTAP) {
156 ic->ic_flags |= IEEE80211_F_ASCAN;
157 ic->ic_stats.is_scan_active++;
159 ic->ic_stats.is_scan_passive++;
160 if (ifp->if_flags & IFF_DEBUG)
161 if_printf(ifp, "begin %s scan\n",
162 (ic->ic_flags & IEEE80211_F_ASCAN) ?
163 "active" : "passive");
165 * Clear scan state and flush any previously seen
166 * AP's. Note that the latter assumes we don't act
167 * as both an AP and a station, otherwise we'll
168 * potentially flush state of stations associated
171 ieee80211_reset_scan(ifp);
172 ieee80211_free_allnodes(ic);
174 /* Scan the next channel. */
175 ieee80211_next_scan(ifp);
179 * Switch to the next channel marked for scanning.
182 ieee80211_next_scan(struct ifnet *ifp)
184 struct ieee80211com *ic = (void *)ifp;
185 struct ieee80211_channel *chan;
187 chan = ic->ic_bss->ni_chan;
189 if (++chan > &ic->ic_channels[IEEE80211_CHAN_MAX])
190 chan = &ic->ic_channels[0];
191 if (isset(ic->ic_chan_scan, ieee80211_chan2ieee(ic, chan))) {
193 * Honor channels marked passive-only
194 * during an active scan.
196 if ((ic->ic_flags & IEEE80211_F_ASCAN) == 0 ||
197 (chan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0)
200 if (chan == ic->ic_bss->ni_chan) {
201 ieee80211_end_scan(ifp);
205 clrbit(ic->ic_chan_scan, ieee80211_chan2ieee(ic, chan));
206 IEEE80211_DPRINTF(("ieee80211_next_scan: chan %d->%d\n",
207 ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan),
208 ieee80211_chan2ieee(ic, chan)));
209 ic->ic_bss->ni_chan = chan;
210 ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
214 ieee80211_create_ibss(struct ieee80211com* ic, struct ieee80211_channel *chan)
216 struct ieee80211_node *ni;
217 struct ifnet *ifp = &ic->ic_if;
220 if (ifp->if_flags & IFF_DEBUG)
221 if_printf(ifp, "creating ibss\n");
222 ic->ic_flags |= IEEE80211_F_SIBSS;
224 ni->ni_rates = ic->ic_sup_rates[ieee80211_chan2mode(ic, ni->ni_chan)];
225 IEEE80211_ADDR_COPY(ni->ni_macaddr, ic->ic_myaddr);
226 IEEE80211_ADDR_COPY(ni->ni_bssid, ic->ic_myaddr);
227 if (ic->ic_opmode == IEEE80211_M_IBSS)
228 ni->ni_bssid[0] |= 0x02; /* local bit for IBSS */
229 ni->ni_esslen = ic->ic_des_esslen;
230 memcpy(ni->ni_essid, ic->ic_des_essid, ni->ni_esslen);
233 memset(ni->ni_tstamp, 0, sizeof(ni->ni_tstamp));
234 ni->ni_intval = ic->ic_lintval;
235 ni->ni_capinfo = IEEE80211_CAPINFO_IBSS;
236 if (ic->ic_flags & IEEE80211_F_WEPON)
237 ni->ni_capinfo |= IEEE80211_CAPINFO_PRIVACY;
238 if (ic->ic_phytype == IEEE80211_T_FH) {
239 ni->ni_fhdwell = 200; /* XXX */
242 ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
246 ieee80211_match_bss(struct ifnet *ifp, struct ieee80211_node *ni)
248 struct ieee80211com *ic = (void *)ifp;
253 if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, ni->ni_chan)))
255 if (ic->ic_des_chan != IEEE80211_CHAN_ANYC &&
256 ni->ni_chan != ic->ic_des_chan)
258 if (ic->ic_opmode == IEEE80211_M_IBSS) {
259 if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0)
262 if ((ni->ni_capinfo & IEEE80211_CAPINFO_ESS) == 0)
265 if (ic->ic_flags & IEEE80211_F_WEPON) {
266 if ((ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) == 0)
269 /* XXX does this mean privacy is supported or required? */
270 if (ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY)
273 rate = ieee80211_fix_rate(ic, ni, IEEE80211_F_DONEGO);
274 if (rate & IEEE80211_RATE_BASIC)
276 if (ic->ic_des_esslen != 0 &&
277 (ni->ni_esslen != ic->ic_des_esslen ||
278 memcmp(ni->ni_essid, ic->ic_des_essid, ic->ic_des_esslen) != 0))
280 if ((ic->ic_flags & IEEE80211_F_DESBSSID) &&
281 !IEEE80211_ADDR_EQ(ic->ic_des_bssid, ni->ni_bssid))
283 #ifdef IEEE80211_DEBUG
284 if (ifp->if_flags & IFF_DEBUG) {
285 printf(" %c %6D", fail ? '-' : '+', ni->ni_macaddr, ":");
286 printf(" %6D%c", ni->ni_bssid, ":", fail & 0x20 ? '!' : ' ');
287 printf(" %3d%c", ieee80211_chan2ieee(ic, ni->ni_chan),
288 fail & 0x01 ? '!' : ' ');
289 printf(" %+4d", ni->ni_rssi);
290 printf(" %2dM%c", (rate & IEEE80211_RATE_VAL) / 2,
291 fail & 0x08 ? '!' : ' ');
293 (ni->ni_capinfo & IEEE80211_CAPINFO_ESS) ? "ess" :
294 (ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) ? "ibss" :
296 fail & 0x02 ? '!' : ' ');
298 (ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) ?
300 fail & 0x04 ? '!' : ' ');
301 ieee80211_print_essid(ni->ni_essid, ni->ni_esslen);
302 printf("%s\n", fail & 0x10 ? "!" : "");
309 * Complete a scan of potential channels.
312 ieee80211_end_scan(struct ifnet *ifp)
314 struct ieee80211com *ic = (void *)ifp;
315 struct ieee80211_node *ni, *nextbs, *selbs;
318 ic->ic_flags &= ~IEEE80211_F_ASCAN;
319 ni = TAILQ_FIRST(&ic->ic_node);
321 if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
323 u_char occupied[roundup(IEEE80211_CHAN_MAX, NBBY)];
325 * The passive scan to look for existing AP's completed,
326 * select a channel to camp on. Identify the channels
327 * that already have one or more AP's and try to locate
328 * an unnoccupied one. If that fails, pick a random
329 * channel from the active set.
331 for (; ni != NULL; ni = nextbs) {
332 ieee80211_ref_node(ni);
333 nextbs = TAILQ_NEXT(ni, ni_list);
334 setbit(occupied, ieee80211_chan2ieee(ic, ni->ni_chan));
335 ieee80211_free_node(ic, ni);
337 for (i = 0; i < IEEE80211_CHAN_MAX; i++)
338 if (isset(ic->ic_chan_active, i) && isclr(occupied, i))
340 if (i == IEEE80211_CHAN_MAX) {
341 fail = arc4random() & 3; /* random 0-3 */
342 for (i = 0; i < IEEE80211_CHAN_MAX; i++)
343 if (isset(ic->ic_chan_active, i) && fail-- == 0)
346 ieee80211_create_ibss(ic, &ic->ic_channels[i]);
350 IEEE80211_DPRINTF(("%s: no scan candidate\n", __func__));
352 if (ic->ic_opmode == IEEE80211_M_IBSS &&
353 (ic->ic_flags & IEEE80211_F_IBSSON) &&
354 ic->ic_des_esslen != 0) {
355 ieee80211_create_ibss(ic, ic->ic_ibss_chan);
359 * Reset the list of channels to scan and start again.
361 ieee80211_reset_scan(ifp);
362 ieee80211_next_scan(ifp);
366 if (ifp->if_flags & IFF_DEBUG)
367 if_printf(ifp, "\tmacaddr bssid chan rssi rate flag wep essid\n");
368 for (; ni != NULL; ni = nextbs) {
369 ieee80211_ref_node(ni);
370 nextbs = TAILQ_NEXT(ni, ni_list);
373 * The configuration of the access points may change
374 * during my scan. So delete the entry for the AP
375 * and retry to associate if there is another beacon.
377 if (ni->ni_fails++ > 2)
378 ieee80211_free_node(ic, ni);
381 if (ieee80211_match_bss(ifp, ni) == 0) {
384 else if (ni->ni_rssi > selbs->ni_rssi) {
385 ieee80211_unref_node(&selbs);
388 ieee80211_unref_node(&ni);
390 ieee80211_unref_node(&ni);
395 (*ic->ic_node_copy)(ic, ic->ic_bss, selbs);
396 if (ic->ic_opmode == IEEE80211_M_IBSS) {
397 ieee80211_fix_rate(ic, ic->ic_bss, IEEE80211_F_DOFRATE |
398 IEEE80211_F_DONEGO | IEEE80211_F_DODEL);
399 if (ic->ic_bss->ni_rates.rs_nrates == 0) {
401 ieee80211_unref_node(&selbs);
404 ieee80211_unref_node(&selbs);
406 * Discard scan set; the nodes have a refcnt of zero
407 * and have not asked the driver to setup private
408 * node state. Let them be repopulated on demand either
409 * through transmission (ieee80211_find_txnode) or receipt
410 * of a probe response (to be added).
412 ieee80211_free_allnodes(ic);
413 ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
415 ieee80211_unref_node(&selbs);
416 ieee80211_new_state(ic, IEEE80211_S_AUTH, -1);
420 static struct ieee80211_node *
421 ieee80211_node_alloc(struct ieee80211com *ic)
423 struct ieee80211_node *ni;
424 MALLOC(ni, struct ieee80211_node *, sizeof(struct ieee80211_node),
425 M_80211_NODE, M_NOWAIT | M_ZERO);
430 ieee80211_node_free(struct ieee80211com *ic, struct ieee80211_node *ni)
432 FREE(ni, M_80211_NODE);
436 ieee80211_node_copy(struct ieee80211com *ic,
437 struct ieee80211_node *dst, const struct ieee80211_node *src)
443 ieee80211_node_getrssi(struct ieee80211com *ic, struct ieee80211_node *ni)
449 ieee80211_setup_node(struct ieee80211com *ic,
450 struct ieee80211_node *ni, uint8_t *macaddr)
455 IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr);
456 hash = IEEE80211_NODE_HASH(macaddr);
457 ni->ni_refcnt = 1; /* mark referenced */
458 lwkt_gettoken(&ilock, &ic->ic_nodetoken);
459 TAILQ_INSERT_TAIL(&ic->ic_node, ni, ni_list);
460 LIST_INSERT_HEAD(&ic->ic_hash[hash], ni, ni_hash);
462 * Note we don't enable the inactive timer when acting
463 * as a station. Nodes created in this mode represent
464 * AP's identified while scanning. If we time them out
465 * then several things happen: we can't return the data
466 * to users to show the list of AP's we encountered, and
467 * more importantly, we'll incorrectly deauthenticate
468 * ourself because the inactivity timer will kick us off.
470 if (ic->ic_opmode != IEEE80211_M_STA)
471 ic->ic_inact_timer = IEEE80211_INACT_WAIT;
472 lwkt_reltoken(&ilock);
475 struct ieee80211_node *
476 ieee80211_alloc_node(struct ieee80211com *ic, uint8_t *macaddr)
478 struct ieee80211_node *ni = (*ic->ic_node_alloc)(ic);
480 ieee80211_setup_node(ic, ni, macaddr);
482 ic->ic_stats.is_rx_nodealloc++;
486 struct ieee80211_node *
487 ieee80211_dup_bss(struct ieee80211com *ic, uint8_t *macaddr)
489 struct ieee80211_node *ni = (*ic->ic_node_alloc)(ic);
491 ieee80211_setup_node(ic, ni, macaddr);
493 * Inherit from ic_bss.
495 IEEE80211_ADDR_COPY(ni->ni_bssid, ic->ic_bss->ni_bssid);
496 ni->ni_chan = ic->ic_bss->ni_chan;
498 ic->ic_stats.is_rx_nodealloc++;
502 static struct ieee80211_node *
503 _ieee80211_find_node(struct ieee80211com *ic, uint8_t *macaddr)
505 struct ieee80211_node *ni;
508 hash = IEEE80211_NODE_HASH(macaddr);
509 LIST_FOREACH(ni, &ic->ic_hash[hash], ni_hash) {
510 if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) {
511 atomic_add_int(&ni->ni_refcnt, 1);/* mark referenced */
518 struct ieee80211_node *
519 ieee80211_find_node(struct ieee80211com *ic, uint8_t *macaddr)
521 struct ieee80211_node *ni;
522 struct lwkt_tokref ilock;
524 lwkt_gettoken(&ilock, &ic->ic_nodetoken);
525 ni = _ieee80211_find_node(ic, macaddr);
526 lwkt_reltoken(&ilock);
531 * Return a reference to the appropriate node for sending
532 * a data frame. This handles node discovery in adhoc networks.
534 struct ieee80211_node *
535 ieee80211_find_txnode(struct ieee80211com *ic, uint8_t *macaddr)
537 struct ieee80211_node *ni;
538 struct lwkt_tokref ilock;
541 * The destination address should be in the node table
542 * unless we are operating in station mode or this is a
543 * multicast/broadcast frame.
545 if (ic->ic_opmode == IEEE80211_M_STA || IEEE80211_IS_MULTICAST(macaddr))
548 /* XXX can't hold lock across dup_bss 'cuz of recursive locking */
549 lwkt_gettoken(&ilock, &ic->ic_nodetoken);
550 ni = _ieee80211_find_node(ic, macaddr);
551 lwkt_reltoken(&ilock);
552 ni = _ieee80211_find_node(ic, macaddr);
554 (ic->ic_opmode == IEEE80211_M_IBSS ||
555 ic->ic_opmode == IEEE80211_M_AHDEMO)) {
557 * Fake up a node; this handles node discovery in
558 * adhoc mode. Note that for the driver's benefit
559 * we we treat this like an association so the driver
560 * has an opportunity to setup it's private state.
562 * XXX need better way to handle this; issue probe
563 * request so we can deduce rate set, etc.
565 ni = ieee80211_dup_bss(ic, macaddr);
567 /* XXX no rate negotiation; just dup */
568 ni->ni_rates = ic->ic_bss->ni_rates;
570 (*ic->ic_newassoc)(ic, ni, 1);
577 * Like find but search based on the channel too.
579 struct ieee80211_node *
580 ieee80211_lookup_node(struct ieee80211com *ic,
581 uint8_t *macaddr, struct ieee80211_channel *chan)
583 struct ieee80211_node *ni;
587 hash = IEEE80211_NODE_HASH(macaddr);
588 lwkt_gettoken(&ilock, &ic->ic_nodetoken);
589 LIST_FOREACH(ni, &ic->ic_hash[hash], ni_hash) {
590 if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) &&
591 ni->ni_chan == chan) {
592 atomic_add_int(&ni->ni_refcnt, 1);/* mark referenced */
596 lwkt_reltoken(&ilock);
601 _ieee80211_free_node(struct ieee80211com *ic, struct ieee80211_node *ni)
603 KASSERT(ni != ic->ic_bss, ("freeing bss node"));
605 TAILQ_REMOVE(&ic->ic_node, ni, ni_list);
606 LIST_REMOVE(ni, ni_hash);
607 if (TAILQ_EMPTY(&ic->ic_node))
608 ic->ic_inact_timer = 0;
609 (*ic->ic_node_free)(ic, ni);
613 ieee80211_free_node(struct ieee80211com *ic, struct ieee80211_node *ni)
617 KASSERT(ni != ic->ic_bss, ("freeing ic_bss"));
619 /* XXX DF atomic op */
622 if (ni->ni_refcnt == 0) {
624 lwkt_gettoken(&ilock, &ic->ic_nodetoken);
625 _ieee80211_free_node(ic, ni);
626 lwkt_reltoken(&ilock);
633 ieee80211_free_allnodes(struct ieee80211com *ic)
635 struct ieee80211_node *ni;
638 lwkt_gettoken(&ilock, &ic->ic_nodetoken);
639 while ((ni = TAILQ_FIRST(&ic->ic_node)) != NULL)
640 _ieee80211_free_node(ic, ni);
641 lwkt_reltoken(&ilock);
645 * Timeout inactive nodes. Note that we cannot hold the node
646 * lock while sending a frame as this would lead to a LOR.
647 * Instead we use a generation number to mark nodes that we've
648 * scanned and drop the lock and restart a scan if we have to
649 * time out a node. Since we are single-threaded by virtue of
650 * controlling the inactivity timer we can be sure this will
651 * process each node only once.
654 ieee80211_timeout_nodes(struct ieee80211com *ic)
656 struct ieee80211_node *ni;
658 u_int gen = ic->ic_scangen++; /* NB: ok 'cuz single-threaded*/
661 lwkt_gettoken(&ilock, &ic->ic_nodetoken);
662 TAILQ_FOREACH(ni, &ic->ic_node, ni_list) {
663 if (ni->ni_scangen == gen) /* previously handled */
665 ni->ni_scangen = gen;
666 if (++ni->ni_inact > IEEE80211_INACT_MAX) {
667 IEEE80211_DPRINTF(("station %6D timed out "
668 "due to inactivity (%u secs)\n",
669 ni->ni_macaddr, ":", ni->ni_inact));
671 * Send a deauthenticate frame.
673 * Drop the node lock before sending the
674 * deauthentication frame in case the driver takes
675 * a lock, as this will result in a LOR between the
676 * node lock and the driver lock.
678 lwkt_reltoken(&ilock);
679 IEEE80211_SEND_MGMT(ic, ni,
680 IEEE80211_FC0_SUBTYPE_DEAUTH,
681 IEEE80211_REASON_AUTH_EXPIRE);
682 ieee80211_free_node(ic, ni);
683 ic->ic_stats.is_node_timeout++;
687 if (!TAILQ_EMPTY(&ic->ic_node))
688 ic->ic_inact_timer = IEEE80211_INACT_WAIT;
689 lwkt_reltoken(&ilock);
693 ieee80211_iterate_nodes(struct ieee80211com *ic, ieee80211_iter_func *f, void *arg)
695 struct ieee80211_node *ni;
696 struct lwkt_tokref ilock;
698 lwkt_gettoken(&ilock, &ic->ic_nodetoken);
699 TAILQ_FOREACH(ni, &ic->ic_node, ni_list)
701 lwkt_reltoken(&ilock);