Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net80211 Style, no functional change.
details: https://anonhg.NetBSD.org/src/rev/bb44625c6b62
branches: trunk
changeset: 829134:bb44625c6b62
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Jan 18 17:59:29 2018 +0000
description:
Style, no functional change.
diffstat:
sys/net80211/ieee80211_node.c | 104 +++++++++++++++++++++++++++++++----------
1 files changed, 77 insertions(+), 27 deletions(-)
diffs (truncated from 479 to 300 lines):
diff -r 4a441972cd7d -r bb44625c6b62 sys/net80211/ieee80211_node.c
--- a/sys/net80211/ieee80211_node.c Thu Jan 18 17:57:49 2018 +0000
+++ b/sys/net80211/ieee80211_node.c Thu Jan 18 17:59:29 2018 +0000
@@ -1,5 +1,6 @@
-/* $NetBSD: ieee80211_node.c,v 1.74 2018/01/16 18:53:32 maxv Exp $ */
-/*-
+/* $NetBSD: ieee80211_node.c,v 1.75 2018/01/18 17:59:29 maxv Exp $ */
+
+/*
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
* All rights reserved.
@@ -36,7 +37,7 @@
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $");
#endif
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.74 2018/01/16 18:53:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.75 2018/01/18 17:59:29 maxv Exp $");
#endif
#ifdef _KERNEL_OPT
@@ -300,8 +301,8 @@
void
ieee80211_begin_scan(struct ieee80211com *ic, int reset)
{
+ ic->ic_scan.nt_scangen++;
- ic->ic_scan.nt_scangen++;
/*
* In all but hostap mode scanning starts off in
* an active mode before switching to passive.
@@ -315,6 +316,7 @@
"begin %s scan in %s mode, scangen %u\n",
(ic->ic_flags & IEEE80211_F_ASCAN) ? "active" : "passive",
ieee80211_phymode_name[ic->ic_curmode], ic->ic_scan.nt_scangen);
+
/*
* Clear scan state and flush any previously seen AP's.
*/
@@ -365,6 +367,7 @@
return 1;
}
} while (chan != ic->ic_curchan);
+
ieee80211_end_scan(ic);
return 0;
}
@@ -455,12 +458,14 @@
else
ni->ni_bssid[0] |= 0x02; /* local bit for IBSS */
}
+
/*
* Fix the channel and related attributes.
*/
ieee80211_set_chan(ic, ni, chan);
ic->ic_curchan = chan;
ic->ic_curmode = ieee80211_chan2mode(ic, chan);
+
/*
* Do mode-specific rate setup.
*/
@@ -476,7 +481,7 @@
ieee80211_set11gbasicrates(&ni->ni_rates, IEEE80211_MODE_11B);
}
- (void) ieee80211_sta_join(ic, ieee80211_ref_node(ni));
+ (void)ieee80211_sta_join(ic, ieee80211_ref_node(ni));
}
void
@@ -504,8 +509,8 @@
static int
ieee80211_match_bss(struct ieee80211com *ic, struct ieee80211_node *ni)
{
- u_int8_t rate;
- int fail;
+ u_int8_t rate;
+ int fail;
fail = 0;
if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, ni->ni_chan)))
@@ -513,6 +518,7 @@
if (ic->ic_des_chan != IEEE80211_CHAN_ANYC &&
ni->ni_chan != ic->ic_des_chan)
fail |= 0x01;
+
if (ic->ic_opmode == IEEE80211_M_IBSS) {
if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0)
fail |= 0x02;
@@ -520,6 +526,7 @@
if ((ni->ni_capinfo & IEEE80211_CAPINFO_ESS) == 0)
fail |= 0x02;
}
+
if (ic->ic_flags & IEEE80211_F_PRIVACY) {
if ((ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) == 0)
fail |= 0x04;
@@ -528,18 +535,23 @@
if (ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY)
fail |= 0x04;
}
+
rate = ieee80211_fix_rate(ni, IEEE80211_R_DONEGO | IEEE80211_R_DOFRATE);
if (rate & IEEE80211_RATE_BASIC)
fail |= 0x08;
+
if (ic->ic_des_esslen != 0 &&
(ni->ni_esslen != ic->ic_des_esslen ||
memcmp(ni->ni_essid, ic->ic_des_essid, ic->ic_des_esslen) != 0))
fail |= 0x10;
+
if ((ic->ic_flags & IEEE80211_F_DESBSSID) &&
!IEEE80211_ADDR_EQ(ic->ic_des_bssid, ni->ni_bssid))
fail |= 0x20;
+
if (ni->ni_fails >= STA_FAILS_MAX)
fail |= 0x40;
+
#ifdef IEEE80211_DEBUG
if (ieee80211_msg_scan(ic)) {
printf(" %c %s",
@@ -565,6 +577,7 @@
printf("%s\n", fail & 0x10 ? "!" : "");
}
#endif
+
return fail;
}
@@ -584,9 +597,8 @@
* Used to select the best scan candidate for association in a BSS.
*/
static int
-ieee80211_node_compare(struct ieee80211com *ic,
- const struct ieee80211_node *a,
- const struct ieee80211_node *b)
+ieee80211_node_compare(struct ieee80211com *ic, const struct ieee80211_node *a,
+ const struct ieee80211_node *b)
{
u_int8_t maxa, maxb;
u_int8_t rssia, rssib;
@@ -675,9 +687,10 @@
maxrssi[i] = rssi;
}
IEEE80211_NODE_UNLOCK(nt);
+
/* XXX select channel more intelligently */
bestchan = -1;
- for (i = 0; i < IEEE80211_CHAN_MAX; i++)
+ for (i = 0; i < IEEE80211_CHAN_MAX; i++) {
if (isset(ic->ic_chan_active, i)) {
/*
* If the channel is unoccupied the max rssi
@@ -693,6 +706,7 @@
maxrssi[i] < maxrssi[bestchan])
bestchan = i;
}
+ }
if (bestchan != -1) {
ieee80211_create_ibss(ic, &ic->ic_channels[bestchan]);
return;
@@ -709,6 +723,7 @@
*/
if (ic->ic_roaming == IEEE80211_ROAMING_MANUAL)
return;
+
/*
* Automatic sequencing; look for a candidate and
* if found join the network.
@@ -717,13 +732,15 @@
if (TAILQ_FIRST(&nt->nt_node) == NULL) {
IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN,
"%s: no scan candidate\n", __func__);
- notfound:
+
+notfound:
if (ic->ic_opmode == IEEE80211_M_IBSS &&
(ic->ic_flags & IEEE80211_F_IBSSON) &&
ic->ic_des_esslen != 0) {
ieee80211_create_ibss(ic, ic->ic_ibss_chan);
return;
}
+
/*
* Decrement the failure counts so entries will be
* reconsidered the next time around. We really want
@@ -731,10 +748,12 @@
* had some success.
*/
IEEE80211_NODE_LOCK(nt);
- TAILQ_FOREACH(ni, &nt->nt_node, ni_list)
+ TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
if (ni->ni_fails)
ni->ni_fails--;
+ }
IEEE80211_NODE_UNLOCK(nt);
+
/*
* Reset the list of channels to scan and start again.
*/
@@ -743,9 +762,11 @@
ieee80211_next_scan(ic);
return;
}
+
selbs = NULL;
IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN, "\t%s\n",
"macaddr bssid chan rssi rate flag wep essid");
+
IEEE80211_NODE_LOCK(nt);
TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
if (ieee80211_match_bss(ic, ni) == 0) {
@@ -756,8 +777,9 @@
}
}
if (selbs != NULL) /* NB: grab ref while dropping lock */
- (void) ieee80211_ref_node(selbs);
+ (void)ieee80211_ref_node(selbs);
IEEE80211_NODE_UNLOCK(nt);
+
if (selbs == NULL)
goto notfound;
if (!ieee80211_sta_join(ic, selbs)) {
@@ -818,13 +840,15 @@
if (ic->ic_opmode == IEEE80211_M_IBSS) {
struct ieee80211_node_table *nt;
+
/*
* Delete unusable rates; we've already checked
* that the negotiated rate set is acceptable.
*/
ieee80211_fix_rate(selbs, IEEE80211_R_DODEL);
+
/*
- * Fillin the neighbor table; it will already
+ * Fill in the neighbor table; it will already
* exist if we are simply switching mastership.
* XXX ic_sta always setup so this is unnecessary?
*/
@@ -844,6 +868,7 @@
copy_bss(selbs, obss);
ieee80211_free_node(obss);
}
+
/*
* Set the erp state (mostly the slot time) to deal with
* the auto-select case; this should be redundant if the
@@ -884,6 +909,7 @@
IASSERT(ieee80211_node_refcnt(ni) > 0,
("refcnt(ni) == %d", ieee80211_node_refcnt(ni)));
IASSERT(ic != NULL, ("ic != NULL"));
+
if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE) {
rs = &ic->ic_sup_rates[ic->ic_curmode];
rate = rs->rs_rates[ic->ic_fixed_rate] & IEEE80211_RATE_VAL;
@@ -897,9 +923,9 @@
(rate * 5) % 10);
goto no_rate;
}
- } else if (ic->ic_state == IEEE80211_S_RUN)
+ } else if (ic->ic_state == IEEE80211_S_RUN) {
rate = ni->ni_rates.rs_rates[ni->ni_txrate];
- else {
+ } else {
no_rate:
rs = &ni->ni_rates;
/* Choose node's lowest basic rate, or else its lowest rate. */
@@ -909,6 +935,7 @@
}
return ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL;
}
+
return rate & IEEE80211_RATE_VAL;
}
@@ -943,6 +970,7 @@
"[%s] power save mode off, %u sta's in ps mode\n",
ether_sprintf(ni->ni_macaddr), ic->ic_ps_sta);
}
+
/*
* Clear AREF flag that marks the authorization refcnt bump
* has happened. This is probably not needed as the node
@@ -963,6 +991,7 @@
free(ni->ni_challenge, M_DEVBUF);
ni->ni_challenge = NULL;
}
+
/*
* Preserve SSID, WPA, and WME ie's so the bss node is
* reusable during a re-auth/re-assoc state transition.
@@ -975,11 +1004,13 @@
*
* XXX does this leave us open to inheriting old state?
*/
- for (i = 0; i < N(ni->ni_rxfrag); i++)
+ for (i = 0; i < N(ni->ni_rxfrag); i++) {
if (ni->ni_rxfrag[i] != NULL) {
Home |
Main Index |
Thread Index |
Old Index