aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/net80211/ieee80211_adhoc.c3
-rw-r--r--sys/net80211/ieee80211_hostap.c6
-rw-r--r--sys/net80211/ieee80211_input.c8
-rw-r--r--sys/net80211/ieee80211_input.h3
-rw-r--r--sys/net80211/ieee80211_mesh.c3
-rw-r--r--sys/net80211/ieee80211_output.c8
-rw-r--r--sys/net80211/ieee80211_proto.c8
-rw-r--r--sys/net80211/ieee80211_proto.h17
-rw-r--r--sys/net80211/ieee80211_scan.c3
-rw-r--r--sys/net80211/ieee80211_sta.c6
-rw-r--r--sys/net80211/ieee80211_tdma.c3
-rw-r--r--sys/net80211/ieee80211_wds.c3
12 files changed, 33 insertions, 38 deletions
diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c
index eca987764216..d3b19373e9c1 100644
--- a/sys/net80211/ieee80211_adhoc.c
+++ b/sys/net80211/ieee80211_adhoc.c
@@ -613,8 +613,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m,
if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
- ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif
diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c
index 5965a5ed2e66..3b2670ca0915 100644
--- a/sys/net80211/ieee80211_hostap.c
+++ b/sys/net80211/ieee80211_hostap.c
@@ -831,8 +831,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m,
if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
- ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif
@@ -2184,8 +2183,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
}
IEEE80211_NOTE(vap, IEEE80211_MSG_AUTH, ni,
"recv %s (reason: %d (%s))",
- ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ ieee80211_mgt_subtype_name(subtype),
reason, ieee80211_reason_to_string(reason));
if (ni != vap->iv_bss)
ieee80211_node_leave(ni);
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index b1e4e9d682bd..3836ee5ed270 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -930,12 +930,8 @@ ieee80211_discard_frame(const struct ieee80211vap *vap,
if_printf(vap->iv_ifp, "[%s] discard ",
ether_sprintf(ieee80211_getbssid(vap, wh)));
- if (type == NULL) {
- printf("%s frame, ", ieee80211_mgt_subtype_name[
- (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) >>
- IEEE80211_FC0_SUBTYPE_SHIFT]);
- } else
- printf("%s frame, ", type);
+ printf("%s frame, ", type != NULL ? type :
+ ieee80211_mgt_subtype_name(wh->i_fc[0]));
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
diff --git a/sys/net80211/ieee80211_input.h b/sys/net80211/ieee80211_input.h
index 97510d3b017b..6fb0d707ce03 100644
--- a/sys/net80211/ieee80211_input.h
+++ b/sys/net80211/ieee80211_input.h
@@ -62,8 +62,7 @@ void ieee80211_ssid_mismatch(struct ieee80211vap *, const char *tag,
memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) { \
if (ieee80211_msg_input(vap)) \
ieee80211_ssid_mismatch(vap, \
- ieee80211_mgt_subtype_name[subtype >> \
- IEEE80211_FC0_SUBTYPE_SHIFT], \
+ ieee80211_mgt_subtype_name(subtype), \
wh->i_addr2, _ssid); \
vap->iv_stats.is_rx_ssidmismatch++; \
_action; \
diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c
index c48c2f3a0940..58ec8c11df1a 100644
--- a/sys/net80211/ieee80211_mesh.c
+++ b/sys/net80211/ieee80211_mesh.c
@@ -1793,8 +1793,7 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m,
(vap->iv_ic->ic_flags & IEEE80211_F_SCAN)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
- ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index 532317964a37..857b042d144f 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -804,9 +804,7 @@ ieee80211_mgmt_output(struct ieee80211_node *ni, struct mbuf *m, int type,
if (vap->iv_state == IEEE80211_S_CAC) {
IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT | IEEE80211_MSG_DOTH,
ni, "block %s frame in CAC state",
- ieee80211_mgt_subtype_name[
- (type & IEEE80211_FC0_SUBTYPE_MASK) >>
- IEEE80211_FC0_SUBTYPE_SHIFT]);
+ ieee80211_mgt_subtype_name(type));
vap->iv_stats.is_tx_badstate++;
ieee80211_free_node(ni);
m_freem(m);
@@ -841,9 +839,7 @@ ieee80211_mgmt_output(struct ieee80211_node *ni, struct mbuf *m, int type,
ieee80211_msg_dumppkts(vap)) {
printf("[%s] send %s on channel %u\n",
ether_sprintf(wh->i_addr1),
- ieee80211_mgt_subtype_name[
- (type & IEEE80211_FC0_SUBTYPE_MASK) >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ ieee80211_mgt_subtype_name(type),
ieee80211_chan2ieee(ic, ic->ic_curchan));
}
#endif
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
index 5301f975ef87..6704fea6f185 100644
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -63,13 +63,13 @@ __FBSDID("$FreeBSD$");
#define AGGRESSIVE_MODE_SWITCH_HYSTERESIS 3 /* pkts / 100ms */
#define HIGH_PRI_SWITCH_THRESH 10 /* pkts / 100ms */
-const char *ieee80211_mgt_subtype_name[] = {
+const char *mgt_subtype_name[] = {
"assoc_req", "assoc_resp", "reassoc_req", "reassoc_resp",
"probe_req", "probe_resp", "timing_adv", "reserved#7",
"beacon", "atim", "disassoc", "auth",
"deauth", "action", "action_noack", "reserved#15"
};
-const char *ieee80211_ctl_subtype_name[] = {
+const char *ctl_subtype_name[] = {
"reserved#0", "reserved#1", "reserved#2", "reserved#3",
"reserved#4", "reserved#5", "reserved#6", "control_wrap",
"bar", "ba", "ps_poll", "rts",
@@ -574,9 +574,7 @@ ieee80211_dump_pkt(struct ieee80211com *ic,
printf(" data");
break;
case IEEE80211_FC0_TYPE_MGT:
- printf(" %s", ieee80211_mgt_subtype_name[
- (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK)
- >> IEEE80211_FC0_SUBTYPE_SHIFT]);
+ printf(" %s", ieee80211_mgt_subtype_name(wh->i_fc[0]));
break;
default:
printf(" type#%d", wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK);
diff --git a/sys/net80211/ieee80211_proto.h b/sys/net80211/ieee80211_proto.h
index 607e4b67a190..74f8ebcd0021 100644
--- a/sys/net80211/ieee80211_proto.h
+++ b/sys/net80211/ieee80211_proto.h
@@ -47,10 +47,25 @@ enum ieee80211_state {
#define IEEE80211_SEND_MGMT(_ni,_type,_arg) \
((*(_ni)->ni_ic->ic_send_mgmt)(_ni, _type, _arg))
-extern const char *ieee80211_mgt_subtype_name[];
+extern const char *mgt_subtype_name[];
+extern const char *ctl_subtype_name[];
extern const char *ieee80211_phymode_name[IEEE80211_MODE_MAX];
extern const int ieee80211_opcap[IEEE80211_OPMODE_MAX];
+static __inline const char *
+ieee80211_mgt_subtype_name(uint8_t subtype)
+{
+ return mgt_subtype_name[(subtype & IEEE80211_FC0_SUBTYPE_MASK) >>
+ IEEE80211_FC0_SUBTYPE_SHIFT];
+}
+
+static __inline const char *
+ieee80211_ctl_subtype_name(uint8_t subtype)
+{
+ return ctl_subtype_name[(subtype & IEEE80211_FC0_SUBTYPE_MASK) >>
+ IEEE80211_FC0_SUBTYPE_SHIFT];
+}
+
const char *ieee80211_reason_to_string(uint16_t);
void ieee80211_proto_attach(struct ieee80211com *);
diff --git a/sys/net80211/ieee80211_scan.c b/sys/net80211/ieee80211_scan.c
index 8bc5d2eed0d1..eca9c399e32c 100644
--- a/sys/net80211/ieee80211_scan.c
+++ b/sys/net80211/ieee80211_scan.c
@@ -539,8 +539,7 @@ ieee80211_scan_dump_probe_beacon(uint8_t subtype, int isnew,
printf("[%s] %s%s on chan %u (bss chan %u) ",
ether_sprintf(mac), isnew ? "new " : "",
- ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT],
- sp->chan, sp->bchan);
+ ieee80211_mgt_subtype_name(subtype), sp->chan, sp->bchan);
ieee80211_print_essid(sp->ssid + 2, sp->ssid[1]);
printf(" rssi %d\n", rssi);
diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c
index 0c0eb13cd596..8580adfb13e7 100644
--- a/sys/net80211/ieee80211_sta.c
+++ b/sys/net80211/ieee80211_sta.c
@@ -880,8 +880,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m,
if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
- ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif
@@ -892,8 +891,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m,
* should be encrypted, discard all others.
*/
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
- wh, ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ wh, ieee80211_mgt_subtype_name(subtype),
"%s", "WEP set but not permitted");
vap->iv_stats.is_rx_mgtdiscard++; /* XXX */
goto out;
diff --git a/sys/net80211/ieee80211_tdma.c b/sys/net80211/ieee80211_tdma.c
index 278decf97b9a..e85cb9827dee 100644
--- a/sys/net80211/ieee80211_tdma.c
+++ b/sys/net80211/ieee80211_tdma.c
@@ -343,8 +343,7 @@ tdma_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
*/
IEEE80211_DISCARD(vap,
IEEE80211_MSG_ELEMID | IEEE80211_MSG_INPUT,
- wh, ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ wh, ieee80211_mgt_subtype_name(subtype),
"%s", "no TDMA ie");
vap->iv_stats.is_rx_mgtdiscard++;
return;
diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c
index 7fe91ccb9653..b46fd056303c 100644
--- a/sys/net80211/ieee80211_wds.c
+++ b/sys/net80211/ieee80211_wds.c
@@ -693,8 +693,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m,
#ifdef IEEE80211_DEBUG
if (ieee80211_msg_debug(vap) || ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
- ieee80211_mgt_subtype_name[subtype >>
- IEEE80211_FC0_SUBTYPE_SHIFT],
+ ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
#endif