diff options
author | avos <avos@FreeBSD.org> | 2016-05-12 22:17:00 +0000 |
---|---|---|
committer | avos <avos@FreeBSD.org> | 2016-05-12 22:17:00 +0000 |
commit | aa261389ce59719566d0ad3e7b3aa7665ac6aa6a (patch) | |
tree | bcca8068169ee643e0121bc2e1c9a09de49d1593 | |
parent | 31330e2843519387b4c579f8bd23a6e0f00bcf26 (diff) | |
download | FreeBSD-src-aa261389ce59719566d0ad3e7b3aa7665ac6aa6a.zip FreeBSD-src-aa261389ce59719566d0ad3e7b3aa7665ac6aa6a.tar.gz |
net80211: drop some unused variables / local macros
Most of them left after some commits (r178354, r191544, r287197 etc.);
some were never used.
Found by: Clang Static Analyzer
-rw-r--r-- | sys/net80211/ieee80211_adhoc.c | 3 | ||||
-rw-r--r-- | sys/net80211/ieee80211_hostap.c | 13 | ||||
-rw-r--r-- | sys/net80211/ieee80211_hwmp.c | 5 | ||||
-rw-r--r-- | sys/net80211/ieee80211_mesh.c | 11 | ||||
-rw-r--r-- | sys/net80211/ieee80211_node.c | 6 | ||||
-rw-r--r-- | sys/net80211/ieee80211_output.c | 7 | ||||
-rw-r--r-- | sys/net80211/ieee80211_phy.c | 7 | ||||
-rw-r--r-- | sys/net80211/ieee80211_scan_sw.c | 17 | ||||
-rw-r--r-- | sys/net80211/ieee80211_sta.c | 8 | ||||
-rw-r--r-- | sys/net80211/ieee80211_wds.c | 2 |
10 files changed, 5 insertions, 74 deletions
diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index b7f4bbd..0a03ed2 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -674,7 +674,7 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, struct ieee80211com *ic = ni->ni_ic; struct ieee80211_channel *rxchan = ic->ic_curchan; struct ieee80211_frame *wh; - uint8_t *frm, *efrm, *sfrm; + uint8_t *frm, *efrm; uint8_t *ssid, *rates, *xrates; #if 0 int ht_state_change = 0; @@ -809,7 +809,6 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, * [tlv] extended supported rates */ ssid = rates = xrates = NULL; - sfrm = frm; while (efrm - frm > 1) { IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return); switch (*frm) { diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 1f32c7e..60535b2 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -412,16 +412,8 @@ hostap_deliver_data(struct ieee80211vap *vap, ieee80211_free_node(sta); } } - if (mcopy != NULL) { - int len, err; - len = mcopy->m_pkthdr.len; - err = ieee80211_vap_xmitpkt(vap, mcopy); - if (err) { - /* NB: IFQ_HANDOFF reclaims mcopy */ - } else { - if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); - } - } + if (mcopy != NULL && ieee80211_vap_xmitpkt(vap, mcopy) == 0) + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } if (m != NULL) { /* @@ -1798,7 +1790,6 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, * [tlv] extended supported rates */ ssid = rates = xrates = NULL; - sfrm = frm; while (efrm - frm > 1) { IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return); switch (*frm) { diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index cfc7759..192024e 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -128,7 +128,6 @@ typedef uint32_t ieee80211_hwmp_seq; #define HWMP_SEQ_LEQ(a, b) ((int32_t)((a)-(b)) <= 0) #define HWMP_SEQ_EQ(a, b) ((int32_t)((a)-(b)) == 0) #define HWMP_SEQ_GT(a, b) ((int32_t)((a)-(b)) > 0) -#define HWMP_SEQ_GEQ(a, b) ((int32_t)((a)-(b)) >= 0) #define HWMP_SEQ_MAX(a, b) (a > b ? a : b) @@ -1526,7 +1525,6 @@ hwmp_peerdown(struct ieee80211_node *ni) #define PERR_DADDR(n) perr->perr_dests[n].dest_addr #define PERR_DSEQ(n) perr->perr_dests[n].dest_seq #define PERR_DEXTADDR(n) perr->perr_dests[n].dest_ext_addr -#define PERR_DRCODE(n) perr->perr_dests[n].dest_rcode static void hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshperr_ie *perr) @@ -1628,7 +1626,6 @@ done: #undef PERR_DADDR #undef PERR_DSEQ #undef PERR_DEXTADDR -#undef PERR_DRCODE static int hwmp_send_perr(struct ieee80211vap *vap, @@ -1737,7 +1734,6 @@ hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_node *ni, struct ieee80211_hwmp_route *hr; struct ieee80211_meshpreq_ie preq; struct ieee80211_meshrann_ie prann; - uint32_t metric = 0; if (IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr)) return; @@ -1766,7 +1762,6 @@ hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_node *ni, /* RANN ACCEPTED */ ieee80211_hwmp_rannint = rann->rann_interval; /* XXX: mtx lock? */ - metric = rann->rann_metric + ms->ms_pmetric->mpm_metric(ni); if (rt == NULL) { rt = ieee80211_mesh_rt_add(vap, rann->rann_addr); diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index 17adda0..7ba784b 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -1526,7 +1526,6 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m, { #define HAS_SEQ(type) ((type & 0x4) == 0) #define MC01(mc) ((const struct ieee80211_meshcntl_ae01 *)mc) -#define MC10(mc) ((const struct ieee80211_meshcntl_ae10 *)mc) struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; struct ifnet *ifp = vap->iv_ifp; @@ -1826,7 +1825,6 @@ out: return type; #undef HAS_SEQ #undef MC01 -#undef MC10 } static void @@ -1981,7 +1979,6 @@ mesh_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, case IEEE80211_FC0_SUBTYPE_PROBE_REQ: { uint8_t *ssid, *meshid, *rates, *xrates; - uint8_t *sfrm; if (vap->iv_state != IEEE80211_S_RUN) { IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, @@ -2005,7 +2002,6 @@ mesh_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, * [tlv] mesh id */ ssid = meshid = rates = xrates = NULL; - sfrm = frm; while (efrm - frm > 1) { IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return); switch (*frm) { @@ -2116,10 +2112,10 @@ mesh_parse_meshpeering_action(struct ieee80211_node *ni, struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_meshpeer_ie *mpie; uint16_t args[3]; - const uint8_t *meshid, *meshconf, *meshpeer; + const uint8_t *meshid, *meshconf; uint8_t sendclose = 0; /* 1 = MPM frame rejected, close will be sent */ - meshid = meshconf = meshpeer = NULL; + meshid = meshconf = NULL; while (efrm - frm > 1) { IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return NULL); switch (*frm) { @@ -2130,7 +2126,6 @@ mesh_parse_meshpeering_action(struct ieee80211_node *ni, meshconf = frm; break; case IEEE80211_ELEMID_MESHPEER: - meshpeer = frm; mpie = (const struct ieee80211_meshpeer_ie *) frm; memset(mp, 0, sizeof(*mp)); mp->peer_len = mpie->peer_len; @@ -2660,7 +2655,6 @@ mesh_send_action(struct ieee80211_node *ni, struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; struct ieee80211_bpf_params params; - struct ieee80211_frame *wh; int ret; KASSERT(ni != NULL, ("null node")); @@ -2681,7 +2675,6 @@ mesh_send_action(struct ieee80211_node *ni, } IEEE80211_TX_LOCK(ic); - wh = mtod(m, struct ieee80211_frame *); ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_ACTION, IEEE80211_NONQOS_TID, sa, da, sa); diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index c1135af..fd134e1 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -73,12 +73,6 @@ CTASSERT((IEEE80211_NODE_HASHSIZE & (IEEE80211_NODE_HASHSIZE-1)) == 0); #define IEEE80211_AID_ISSET(_vap, b) \ ((_vap)->iv_aid_bitmap[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32))) -#ifdef IEEE80211_DEBUG_REFCNT -#define REFCNT_LOC "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line -#else -#define REFCNT_LOC "%s %p<%s> refcnt %d\n", __func__ -#endif - static int ieee80211_sta_join1(struct ieee80211_node *); static struct ieee80211_node *node_alloc(struct ieee80211vap *, diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 68e46eb..65fe126 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -121,7 +121,6 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, struct mbuf *m, { struct ieee80211com *ic = vap->iv_ic; struct ifnet *ifp = vap->iv_ifp; - int len, mcast; if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && (m->m_flags & M_PWR_SAV) == 0) { @@ -161,8 +160,6 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, struct mbuf *m, * interface it (might have been) received on. */ m->m_pkthdr.rcvif = (void *)ni; - mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1: 0; - len = m->m_pkthdr.len; BPF_MTAP(ifp, m); /* 802.3 tx */ @@ -2082,7 +2079,6 @@ ieee80211_send_probereq(struct ieee80211_node *ni, struct ieee80211com *ic = ni->ni_ic; const struct ieee80211_txparam *tp; struct ieee80211_bpf_params params; - struct ieee80211_frame *wh; const struct ieee80211_rateset *rs; struct mbuf *m; uint8_t *frm; @@ -2152,7 +2148,6 @@ ieee80211_send_probereq(struct ieee80211_node *ni, } IEEE80211_TX_LOCK(ic); - wh = mtod(m, struct ieee80211_frame *); ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_REQ, IEEE80211_NONQOS_TID, sa, da, bssid); @@ -2749,7 +2744,6 @@ ieee80211_send_proberesp(struct ieee80211vap *vap, { struct ieee80211_node *bss = vap->iv_bss; struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_frame *wh; struct mbuf *m; int ret; @@ -2781,7 +2775,6 @@ ieee80211_send_proberesp(struct ieee80211vap *vap, KASSERT(m != NULL, ("no room for header")); IEEE80211_TX_LOCK(ic); - wh = mtod(m, struct ieee80211_frame *); ieee80211_send_setup(bss, m, IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP, IEEE80211_NONQOS_TID, vap->iv_myaddr, da, bss->ni_bssid); diff --git a/sys/net80211/ieee80211_phy.c b/sys/net80211/ieee80211_phy.c index 16bbb2a..13cecb6 100644 --- a/sys/net80211/ieee80211_phy.c +++ b/sys/net80211/ieee80211_phy.c @@ -590,10 +590,6 @@ static const uint16_t ht40_bps[32] = { #define HT_STF 4 #define HT_LTF(n) ((n) * 4) -#define HT_RC_2_MCS(_rc) ((_rc) & 0x1f) -#define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1) -#define IS_HT_RATE(_rc) ( (_rc) & IEEE80211_RATE_MCS) - /* * Calculate the transmit duration of an 11n frame. */ @@ -620,9 +616,6 @@ ieee80211_compute_duration_ht(uint32_t frameLen, uint16_t rate, HT_L_SIG + HT_SIG + HT_STF + HT_LTF(streams); } -#undef IS_HT_RATE -#undef HT_RC_2_STREAMS -#undef HT_RC_2_MCS #undef HT_LTF #undef HT_STF #undef HT_SIG diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c index 9899200..f1415cb 100644 --- a/sys/net80211/ieee80211_scan_sw.c +++ b/sys/net80211/ieee80211_scan_sw.c @@ -80,23 +80,6 @@ struct scan_state { */ #define IEEE80211_SCAN_OFFCHANNEL msecs_to_ticks(150) -/* - * Roaming-related defaults. RSSI thresholds are as returned by the - * driver (.5dBm). Transmit rate thresholds are IEEE rate codes (i.e - * .5M units) or MCS. - */ -/* rssi thresholds */ -#define ROAM_RSSI_11A_DEFAULT 14 /* 11a bss */ -#define ROAM_RSSI_11B_DEFAULT 14 /* 11b bss */ -#define ROAM_RSSI_11BONLY_DEFAULT 14 /* 11b-only bss */ -/* transmit rate thresholds */ -#define ROAM_RATE_11A_DEFAULT 2*12 /* 11a bss */ -#define ROAM_RATE_11B_DEFAULT 2*5 /* 11b bss */ -#define ROAM_RATE_11BONLY_DEFAULT 2*1 /* 11b-only bss */ -#define ROAM_RATE_HALF_DEFAULT 2*6 /* half-width 11a/g bss */ -#define ROAM_RATE_QUARTER_DEFAULT 2*3 /* quarter-width 11a/g bss */ -#define ROAM_MCS_11N_DEFAULT (1 | IEEE80211_RATE_MCS) /* 11n bss */ - static void scan_curchan(struct ieee80211_scan_state *, unsigned long); static void scan_mindwell(struct ieee80211_scan_state *); static void scan_signal(struct ieee80211_scan_state *, int); diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 8580adf..90561b2 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -976,7 +976,6 @@ sta_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh, { struct ieee80211vap *vap = ni->ni_vap; uint8_t *challenge; - int estatus; /* * NB: this can happen as we allow pre-shared key @@ -990,7 +989,6 @@ sta_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh, IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH, ni->ni_macaddr, "shared key auth", "%s", " PRIVACY is disabled"); - estatus = IEEE80211_STATUS_ALG; goto bad; } /* @@ -1004,7 +1002,6 @@ sta_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh, ni->ni_macaddr, "shared key auth", "bad sta auth mode %u", ni->ni_authmode); vap->iv_stats.is_rx_bad_auth++; /* XXX maybe a unique error? */ - estatus = IEEE80211_STATUS_ALG; goto bad; } @@ -1016,7 +1013,6 @@ sta_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh, "ie %d/%d too long", frm[0], (frm[1] + 2) - (efrm - frm)); vap->iv_stats.is_rx_bad_auth++; - estatus = IEEE80211_STATUS_CHALLENGE; goto bad; } if (*frm == IEEE80211_ELEMID_CHALLENGE) @@ -1031,7 +1027,6 @@ sta_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh, ni->ni_macaddr, "shared key auth", "%s", "no challenge"); vap->iv_stats.is_rx_bad_auth++; - estatus = IEEE80211_STATUS_CHALLENGE; goto bad; } if (challenge[1] != IEEE80211_CHALLENGE_LEN) { @@ -1039,7 +1034,6 @@ sta_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh, ni->ni_macaddr, "shared key auth", "bad challenge len %d", challenge[1]); vap->iv_stats.is_rx_bad_auth++; - estatus = IEEE80211_STATUS_CHALLENGE; goto bad; } default: @@ -1281,7 +1275,6 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, const struct ieee80211_rx_stats *rxs, int rssi, int nf) { -#define ISPROBE(_st) ((_st) == IEEE80211_FC0_SUBTYPE_PROBE_RESP) #define ISREASSOC(_st) ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP) struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; @@ -1861,7 +1854,6 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, break; } #undef ISREASSOC -#undef ISPROBE } static void diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c index b46fd05..05268e8 100644 --- a/sys/net80211/ieee80211_wds.c +++ b/sys/net80211/ieee80211_wds.c @@ -344,7 +344,6 @@ static int wds_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_node *ni; enum ieee80211_state ostate; int error; @@ -357,7 +356,6 @@ wds_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) callout_stop(&vap->iv_mgtsend); /* XXX callout_drain */ if (ostate != IEEE80211_S_SCAN) ieee80211_cancel_scan(vap); /* background scan */ - ni = vap->iv_bss; /* NB: no reference held */ error = 0; switch (nstate) { case IEEE80211_S_INIT: |