Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net80211 Style on the new functions.
details: https://anonhg.NetBSD.org/src/rev/026cb4673980
branches: trunk
changeset: 358791:026cb4673980
user: maxv <maxv%NetBSD.org@localhost>
date: Tue Jan 16 16:20:57 2018 +0000
description:
Style on the new functions.
diffstat:
sys/net80211/ieee80211_input.c | 152 +++++++++++++++++++++++++---------------
1 files changed, 95 insertions(+), 57 deletions(-)
diffs (truncated from 548 to 300 lines):
diff -r 3ba28ba8f673 -r 026cb4673980 sys/net80211/ieee80211_input.c
--- a/sys/net80211/ieee80211_input.c Tue Jan 16 16:09:30 2018 +0000
+++ b/sys/net80211/ieee80211_input.c Tue Jan 16 16:20:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_input.c,v 1.103 2018/01/16 16:09:30 maxv Exp $ */
+/* $NetBSD: ieee80211_input.c,v 1.104 2018/01/16 16:20:57 maxv Exp $ */
/*
* Copyright (c) 2001 Atsushi Onoe
@@ -37,7 +37,7 @@
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
#endif
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.103 2018/01/16 16:09:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.104 2018/01/16 16:20:57 maxv Exp $");
#endif
#ifdef _KERNEL_OPT
@@ -2096,9 +2096,8 @@
break;
case IEEE80211_ELEMID_ERP:
if (frm[1] != 1) {
- IEEE80211_DISCARD_IE(ic,
- IEEE80211_MSG_ELEMID, wh, "ERP",
- "bad len %u", frm[1]);
+ IEEE80211_DISCARD_IE(ic, IEEE80211_MSG_ELEMID,
+ wh, "ERP", "bad len %u", frm[1]);
ic->ic_stats.is_rx_elem_toobig++;
break;
}
@@ -2116,8 +2115,7 @@
break;
default:
IEEE80211_DISCARD_IE(ic, IEEE80211_MSG_ELEMID,
- wh, "unhandled",
- "id %u, len %u", *frm, frm[1]);
+ wh, "unhandled", "id %u, len %u", *frm, frm[1]);
ic->ic_stats.is_rx_elem_unknown++;
break;
}
@@ -2141,6 +2139,7 @@
ic->ic_stats.is_rx_badchan++;
return;
}
+
if (scan.chan != scan.bchan &&
ic->ic_phytype != IEEE80211_T_FH) {
/*
@@ -2161,6 +2160,7 @@
ic->ic_stats.is_rx_chanmismatch++;
return;
}
+
if (!(IEEE80211_BINTVAL_MIN <= scan.bintval &&
scan.bintval <= IEEE80211_BINTVAL_MAX)) {
IEEE80211_DISCARD(ic,
@@ -2176,27 +2176,28 @@
ni = ieee80211_refine_node_for_beacon(ic, ni,
&ic->ic_channels[scan.chan], scan.ssid);
}
+
/*
* Count frame now that we know it's to be processed.
*/
if (subtype == IEEE80211_FC0_SUBTYPE_BEACON) {
ic->ic_stats.is_rx_beacon++; /* XXX remove */
IEEE80211_NODE_STAT(ni, rx_beacons);
- } else
+ } else {
IEEE80211_NODE_STAT(ni, rx_proberesp);
+ }
/*
* When operating in station mode, check for state updates.
* Be careful to ignore beacons received while doing a
* background scan. We consider only 11g/WMM stuff right now.
*/
- if (ic->ic_opmode == IEEE80211_M_STA &&
- ni->ni_associd != 0 &&
+ if (ic->ic_opmode == IEEE80211_M_STA && ni->ni_associd != 0 &&
((ic->ic_flags & IEEE80211_F_SCAN) == 0 ||
IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_bssid))) {
/* record tsf of last beacon */
- memcpy(ni->ni_tstamp.data, scan.tstamp,
- sizeof(ni->ni_tstamp));
+ memcpy(ni->ni_tstamp.data, scan.tstamp, sizeof(ni->ni_tstamp));
+
if (ni->ni_erp != scan.erp) {
IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
"[%s] erp change: was 0x%x, now 0x%x\n",
@@ -2210,6 +2211,7 @@
ni->ni_erp = scan.erp;
/* XXX statistic */
}
+
if ((ni->ni_capinfo ^ scan.capinfo) & IEEE80211_CAPINFO_SHORT_SLOTTIME) {
IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
"[%s] capabilities change: before 0x%x,"
@@ -2222,25 +2224,30 @@
* change dynamically
*/
ieee80211_set_shortslottime(ic,
- ic->ic_curmode == IEEE80211_MODE_11A ||
- (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME));
+ ic->ic_curmode == IEEE80211_MODE_11A ||
+ (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME));
ni->ni_capinfo = scan.capinfo;
/* XXX statistic */
}
- if (scan.wme != NULL &&
- (ni->ni_flags & IEEE80211_NODE_QOS) &&
- ieee80211_parse_wmeparams(ic, scan.wme, wh) > 0)
+
+ if (scan.wme != NULL && (ni->ni_flags & IEEE80211_NODE_QOS) &&
+ ieee80211_parse_wmeparams(ic, scan.wme, wh) > 0) {
ieee80211_wme_updateparams(ic);
+ }
+
if (scan.tim != NULL) {
struct ieee80211_tim_ie *ie =
- (struct ieee80211_tim_ie *) scan.tim;
+ (struct ieee80211_tim_ie *)scan.tim;
ni->ni_dtim_count = ie->tim_count;
ni->ni_dtim_period = ie->tim_period;
}
- if (ic->ic_flags & IEEE80211_F_SCAN)
- ieee80211_add_scan(ic, &scan, wh,
- subtype, rssi, rstamp);
+
+ if (ic->ic_flags & IEEE80211_F_SCAN) {
+ ieee80211_add_scan(ic, &scan, wh, subtype, rssi,
+ rstamp);
+ }
+
ic->ic_bmiss_count = 0;
return;
}
@@ -2261,12 +2268,13 @@
ieee80211_probe_curchan(ic, 1);
ic->ic_flags_ext &= ~IEEE80211_FEXT_PROBECHAN;
}
- ieee80211_add_scan(ic, &scan, wh,
- subtype, rssi, rstamp);
+ ieee80211_add_scan(ic, &scan, wh, subtype, rssi, rstamp);
return;
}
- if (scan.capinfo & IEEE80211_CAPINFO_IBSS)
+
+ if (scan.capinfo & IEEE80211_CAPINFO_IBSS) {
ieee80211_update_adhoc_node(ic, ni, wh, &scan, rssi, rstamp);
+ }
}
static void
@@ -2316,24 +2324,26 @@
}
frm += frm[1] + 2;
}
+
IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE);
IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN);
IEEE80211_VERIFY_SSID(ic->ic_bss, ssid);
+
if ((ic->ic_flags & IEEE80211_F_HIDESSID) && ssid[1] == 0) {
IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT,
wh, ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ IEEE80211_FC0_SUBTYPE_SHIFT],
"%s", "no ssid with ssid suppression enabled");
ic->ic_stats.is_rx_ssidmismatch++; /*XXX*/
return;
}
if (ni == ic->ic_bss) {
- if (ic->ic_opmode != IEEE80211_M_IBSS)
+ if (ic->ic_opmode != IEEE80211_M_IBSS) {
ni = ieee80211_tmp_node(ic, wh->i_addr2);
- else if (IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr))
+ } else if (IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) {
;
- else {
+ } else {
/*
* XXX Cannot tell if the sender is operating
* in ibss mode. But we need a new node to
@@ -2346,25 +2356,29 @@
if (ni == NULL)
return;
allocbs = 1;
- } else
+ } else {
allocbs = 0;
- IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
- "[%s] recv probe req\n", ether_snprintf(
- ebuf, sizeof(ebuf), wh->i_addr2));
+ }
+
+ IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, "[%s] recv probe req\n",
+ ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2));
+
ni->ni_rssi = rssi;
ni->ni_rstamp = rstamp;
rate = ieee80211_setup_rates(ni, rates, xrates,
IEEE80211_R_DOSORT | IEEE80211_R_DOFRATE
| IEEE80211_R_DONEGO | IEEE80211_R_DODEL);
+
if (rate & IEEE80211_RATE_BASIC) {
IEEE80211_DISCARD(ic, IEEE80211_MSG_XRATE,
wh, ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ IEEE80211_FC0_SUBTYPE_SHIFT],
"%s", "recv'd rate set invalid");
} else {
IEEE80211_SEND_MGMT(ic, ni,
- IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
+ IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
}
+
if (allocbs && ic->ic_opmode != IEEE80211_M_IBSS) {
/* reclaim immediately */
ieee80211_free_node(ni);
@@ -2378,12 +2392,12 @@
struct ieee80211_frame *wh;
u_int8_t *frm, *efrm;
IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]);
+ u_int16_t algo, seq, status;
wh = mtod(m0, struct ieee80211_frame *);
frm = (u_int8_t *)(wh + 1);
efrm = mtod(m0, u_int8_t *) + m0->m_len;
- u_int16_t algo, seq, status;
/*
* auth frame format
* [2] algorithm
@@ -2395,14 +2409,15 @@
algo = le16toh(*(u_int16_t *)frm);
seq = le16toh(*(u_int16_t *)(frm + 2));
status = le16toh(*(u_int16_t *)(frm + 4));
+
IEEE80211_DPRINTF(ic, IEEE80211_MSG_AUTH,
"[%s] recv auth frame with algorithm %d seq %d\n",
ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2), algo, seq);
+
/*
* Consult the ACL policy module if setup.
*/
- if (ic->ic_acl != NULL &&
- !ic->ic_acl->iac_check(ic, wh->i_addr2)) {
+ if (ic->ic_acl != NULL && !ic->ic_acl->iac_check(ic, wh->i_addr2)) {
IEEE80211_DISCARD(ic, IEEE80211_MSG_ACL,
wh, "auth", "%s", "disallowed by ACL");
ic->ic_stats.is_rx_acl++;
@@ -2413,6 +2428,7 @@
}
return;
}
+
if (ic->ic_flags & IEEE80211_F_COUNTERM) {
IEEE80211_DISCARD(ic,
IEEE80211_MSG_AUTH | IEEE80211_MSG_CRYPTO,
@@ -2424,9 +2440,10 @@
IEEE80211_FC0_SUBTYPE_AUTH,
IEEE80211_REASON_MIC_FAILURE);
}
-#endif /* !IEEE80211_NO_HOSTAP */
+#endif
return;
}
+
if (algo == IEEE80211_AUTH_ALG_SHARED)
ieee80211_auth_shared(ic, wh, frm + 6, efrm, ni, rssi,
rstamp, seq, status);
@@ -2444,7 +2461,7 @@
IEEE80211_FC0_SUBTYPE_AUTH,
(seq+1) | (IEEE80211_STATUS_ALG<<16));
}
-#endif /* !IEEE80211_NO_HOSTAP */
+#endif
return;
}
}
@@ -2459,15 +2476,14 @@
int reassoc, resp;
u_int8_t rate;
IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]);
+ u_int16_t capinfo, lintval;
+ struct ieee80211_rsnparms rsn;
+ u_int8_t reason;
wh = mtod(m0, struct ieee80211_frame *);
frm = (u_int8_t *)(wh + 1);
efrm = mtod(m0, u_int8_t *) + m0->m_len;
- u_int16_t capinfo, lintval;
- struct ieee80211_rsnparms rsn;
- u_int8_t reason;
-
if (ic->ic_opmode != IEEE80211_M_HOSTAP ||
Home |
Main Index |
Thread Index |
Old Index