Module Name:    src
Committed By:   maxv
Date:           Thu Jan 18 17:59:29 UTC 2018

Modified Files:
        src/sys/net80211: ieee80211_node.c

Log Message:
Style, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/net80211/ieee80211_node.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net80211/ieee80211_node.c
diff -u src/sys/net80211/ieee80211_node.c:1.74 src/sys/net80211/ieee80211_node.c:1.75
--- src/sys/net80211/ieee80211_node.c:1.74	Tue Jan 16 18:53:32 2018
+++ src/sys/net80211/ieee80211_node.c	Thu Jan 18 17:59:29 2018
@@ -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 @@ ieee80211_reset_scan(struct ieee80211com
 void
 ieee80211_begin_scan(struct ieee80211com *ic, int reset)
 {
-
 	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 @@ ieee80211_begin_scan(struct ieee80211com
 		"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 @@ ieee80211_next_scan(struct ieee80211com 
 			return 1;
 		}
 	} while (chan != ic->ic_curchan);
+
 	ieee80211_end_scan(ic);
 	return 0;
 }
@@ -455,12 +458,14 @@ ieee80211_create_ibss(struct ieee80211co
 		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_create_ibss(struct ieee80211co
 		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 @@ ieee80211_reset_bss(struct ieee80211com 
 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 @@ ieee80211_match_bss(struct ieee80211com 
 	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 @@ ieee80211_match_bss(struct ieee80211com 
 		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 @@ ieee80211_match_bss(struct ieee80211com 
 		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 @@ ieee80211_match_bss(struct ieee80211com 
 		printf("%s\n", fail & 0x10 ? "!" : "");
 	}
 #endif
+
 	return fail;
 }
 
@@ -584,9 +597,8 @@ maxrate(const struct ieee80211_node *ni)
  * 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 @@ ieee80211_end_scan(struct ieee80211com *
 				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 @@ ieee80211_end_scan(struct ieee80211com *
 				    maxrssi[i] < maxrssi[bestchan])
 					bestchan = i;
 			}
+		}
 		if (bestchan != -1) {
 			ieee80211_create_ibss(ic, &ic->ic_channels[bestchan]);
 			return;
@@ -709,6 +723,7 @@ ieee80211_end_scan(struct ieee80211com *
 	 */
 	if (ic->ic_roaming == IEEE80211_ROAMING_MANUAL)
 		return;
+
 	/*
 	 * Automatic sequencing; look for a candidate and
 	 * if found join the network.
@@ -717,13 +732,15 @@ ieee80211_end_scan(struct ieee80211com *
 	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 @@ ieee80211_end_scan(struct ieee80211com *
 		 * 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_end_scan(struct ieee80211com *
 		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 @@ ieee80211_end_scan(struct ieee80211com *
 		}
 	}
 	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 @@ ieee80211_sta_join(struct ieee80211com *
 
 	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 @@ ieee80211_sta_join(struct ieee80211com *
 		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 @@ ieee80211_get_rate(const struct ieee8021
 	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 @@ ieee80211_get_rate(const struct ieee8021
 			    (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 @@ no_rate:
 		}
 		return ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL;
 	}
+
 	return rate & IEEE80211_RATE_VAL;
 }
 
@@ -943,6 +970,7 @@ node_cleanup(struct ieee80211_node *ni)
 		    "[%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 @@ node_cleanup(struct ieee80211_node *ni)
 		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 @@ node_cleanup(struct ieee80211_node *ni)
 	 *
 	 * 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) {
 			m_freem(ni->ni_rxfrag[i]);
 			ni->ni_rxfrag[i] = NULL;
 		}
+	}
+
 	/*
 	 * Must be careful here to remove any key map entry w/o a LOR.
 	 */
@@ -1105,8 +1136,9 @@ ieee80211_dup_bss(struct ieee80211_node_
 		IEEE80211_ADDR_COPY(ni->ni_bssid, ic->ic_bss->ni_bssid);
 		ieee80211_set_chan(ic, ni, ic->ic_bss->ni_chan);
 		ni->ni_rsn = ic->ic_bss->ni_rsn;
-	} else
+	} else {
 		ic->ic_stats.is_rx_nodealloc++;
+	}
 	return ni;
 }
 
@@ -1404,6 +1436,7 @@ ieee80211_find_rxnode(struct ieee80211co
 		nt = &ic->ic_scan;
 	else
 		nt = &ic->ic_sta;
+
 	/* XXX check ic_bss first in station mode */
 	/* XXX 4-address frames? */
 	IEEE80211_NODE_LOCK(nt);
@@ -1441,15 +1474,18 @@ ieee80211_find_rxnode_withkey(struct iee
 
 	if (ic->ic_opmode == IEEE80211_M_STA ||
 	    ic->ic_opmode == IEEE80211_M_MONITOR ||
-	    (ic->ic_flags & IEEE80211_F_SCAN))
+	    (ic->ic_flags & IEEE80211_F_SCAN)) {
 		nt = &ic->ic_scan;
-	else
+	} else {
 		nt = &ic->ic_sta;
+	}
+
 	IEEE80211_NODE_LOCK(nt);
-	if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax)
+	if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax) {
 		ni = nt->nt_keyixmap[keyix];
-	else
+	} else {
 		ni = NULL;
+	}
 	if (ni == NULL) {
 		if (IS_CTL(wh) && !IS_PSPOLL(wh) /*&& !IS_RTS(ah)*/)
 			ni = _ieee80211_find_node(nt, wh->i_addr1);
@@ -1522,7 +1558,7 @@ ieee80211_find_txnode(struct ieee80211co
 			 */
 			ni = ieee80211_fakeup_adhoc_node(nt, macaddr);
 			if (ni != NULL)
-				(void) ieee80211_ref_node(ni);
+				(void)ieee80211_ref_node(ni);
 		} else {
 			IEEE80211_DPRINTF(ic, IEEE80211_MSG_OUTPUT,
 				"[%s] no node, discard frame (%s)\n",
@@ -1550,6 +1586,7 @@ ieee80211_find_node_with_channel(struct 
 	int hash;
 
 	hash = IEEE80211_NODE_HASH(macaddr);
+
 	IEEE80211_NODE_LOCK(nt);
 	LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
 		if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) &&
@@ -1571,6 +1608,7 @@ ieee80211_find_node_with_channel(struct 
 		}
 	}
 	IEEE80211_NODE_UNLOCK(nt);
+
 	return ni;
 }
 
@@ -1616,6 +1654,7 @@ ieee80211_refine_node_for_beacon(struct 
 		}
 	}
 	IEEE80211_NODE_UNLOCK(nt);
+
 	return best;
 }
 
@@ -1674,7 +1713,9 @@ ieee80211_find_node_with_ssid(struct iee
 		     ieee80211_node_refcnt(ni));
 #endif
 	}
+
 	IEEE80211_NODE_UNLOCK(nt);
+
 	return ni;
 #undef MATCH_SSID
 }
@@ -1712,6 +1753,7 @@ ieee80211_free_node(struct ieee80211_nod
 		"%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, ni,
 		 ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)-1);
 #endif
+
 	if (nt != NULL) {
 		IEEE80211_NODE_LOCK(nt);
 		if (ieee80211_node_dectestref(ni)) {
@@ -1722,6 +1764,7 @@ ieee80211_free_node(struct ieee80211_nod
 		} else if (ieee80211_node_refcnt(ni) == 1 &&
 		    nt->nt_keyixmap != NULL) {
 			ieee80211_keyix keyix;
+
 			/*
 			 * Check for a last reference in the key mapping table.
 			 */
@@ -2148,6 +2191,7 @@ ieee80211_node_join_11g(struct ieee80211
 		/* XXX vap's w/ conflicting needs won't work */
 		ieee80211_set_shortslottime(ic, 0);
 	}
+
 	/*
 	 * If the new station is not an ERP station
 	 * then bump the counter and enable protection
@@ -2177,12 +2221,14 @@ ieee80211_node_join_11g(struct ieee80211
 			ic->ic_flags |= IEEE80211_F_USEBARKER;
 			ic->ic_flags &= ~IEEE80211_F_SHPREAMBLE;
 		}
-	} else
+	} else {
 		ni->ni_flags |= IEEE80211_NODE_ERP;
+	}
 }
 
 void
-ieee80211_node_join(struct ieee80211com *ic, struct ieee80211_node *ni, int resp)
+ieee80211_node_join(struct ieee80211com *ic, struct ieee80211_node *ni,
+    int resp)
 {
 	int newassoc;
 
@@ -2270,6 +2316,7 @@ ieee80211_node_leave_11g(struct ieee8021
 			}
 		}
 	}
+
 	/*
 	 * If a non-ERP station do the protection-related bookkeeping.
 	 */
@@ -2308,11 +2355,11 @@ ieee80211_node_leave(struct ieee80211com
 	IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG,
 	    "[%s] station with aid %d leaves\n",
 	    ether_sprintf(ni->ni_macaddr), IEEE80211_NODE_AID(ni));
-
 	IASSERT(ic->ic_opmode == IEEE80211_M_HOSTAP ||
 		ic->ic_opmode == IEEE80211_M_IBSS ||
 		ic->ic_opmode == IEEE80211_M_AHDEMO,
 		("unexpected operating mode %u", ic->ic_opmode));
+
 	/*
 	 * If node wasn't previously associated all
 	 * we need to do is reclaim the reference.
@@ -2320,6 +2367,7 @@ ieee80211_node_leave(struct ieee80211com
 	/* XXX ibss mode bypasses 11g and notification */
 	if (ni->ni_associd == 0)
 		goto done;
+
 	/*
 	 * Tell the authenticator the station is leaving.
 	 * Note that we must do this before yanking the
@@ -2334,6 +2382,7 @@ ieee80211_node_leave(struct ieee80211com
 
 	if (ic->ic_curmode == IEEE80211_MODE_11G)
 		ieee80211_node_leave_11g(ic, ni);
+
 	/*
 	 * Cleanup station state.  In particular clear various
 	 * state that might otherwise be reused if the node
@@ -2341,6 +2390,7 @@ ieee80211_node_leave(struct ieee80211com
 	 * (and memory is reclaimed).
 	 */
 	ieee80211_sta_leave(ic, ni);
+
 done:
 	/*
 	 * Remove the node from any table it's recorded in and

Reply via email to