aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-12-27 17:24:24 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-27 17:35:12 (GMT)
commitb76f4c27638fe7b57a931c7e8b63386aebc536fb (patch)
tree6797c996bf5ac8dcd5b9442fb30de1c99a39c0a4
parentaa03dbd517d7ec1e1d981e7ae548e8ff3405d1f7 (diff)
downloadhostap-b76f4c27638fe7b57a931c7e8b63386aebc536fb.zip
hostap-b76f4c27638fe7b57a931c7e8b63386aebc536fb.tar.gz
hostap-b76f4c27638fe7b57a931c7e8b63386aebc536fb.tar.bz2
hostapd: Make STA flags available through ctrl_iface STA command
Signed-hostap: Jouni Malinen <j@w1.fi>
-rw-r--r--hostapd/dump_state.c26
-rw-r--r--src/ap/ctrl_iface_ap.c12
-rw-r--r--src/ap/sta_info.c30
-rw-r--r--src/ap/sta_info.h2
4 files changed, 48 insertions, 22 deletions
diff --git a/hostapd/dump_state.c b/hostapd/dump_state.c
index 3c639f9..0903438 100644
--- a/hostapd/dump_state.c
+++ b/hostapd/dump_state.c
@@ -100,33 +100,17 @@ static void hostapd_dump_state(struct hostapd_data *hapd)
hapd->iface->num_sta_no_short_preamble);
for (sta = hapd->sta_list; sta != NULL; sta = sta->next) {
+ char flags[200];
+
fprintf(f, "\nSTA=" MACSTR "\n", MAC2STR(sta->addr));
+ ap_sta_flags_txt(sta->flags, flags, sizeof(flags));
fprintf(f,
- " AID=%d flags=0x%x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
- "\n"
+ " AID=%d flags=0x%x %s\n"
" capability=0x%x listen_interval=%d\n",
sta->aid,
sta->flags,
- (sta->flags & WLAN_STA_AUTH ? "[AUTH]" : ""),
- (sta->flags & WLAN_STA_ASSOC ? "[ASSOC]" : ""),
- (ap_sta_is_authorized(sta) ? "[AUTHORIZED]" : ""),
- (sta->flags & WLAN_STA_PENDING_POLL ? "[PENDING_POLL" :
- ""),
- (sta->flags & WLAN_STA_SHORT_PREAMBLE ?
- "[SHORT_PREAMBLE]" : ""),
- (sta->flags & WLAN_STA_PREAUTH ? "[PREAUTH]" : ""),
- (sta->flags & WLAN_STA_WMM ? "[WMM]" : ""),
- (sta->flags & WLAN_STA_MFP ? "[MFP]" : ""),
- (sta->flags & WLAN_STA_WPS ? "[WPS]" : ""),
- (sta->flags & WLAN_STA_MAYBE_WPS ? "[MAYBE_WPS]" : ""),
- (sta->flags & WLAN_STA_WDS ? "[WDS]" : ""),
- (sta->flags & WLAN_STA_NONERP ? "[NonERP]" : ""),
- (sta->flags & WLAN_STA_WPS2 ? "[WPS2]" : ""),
- (sta->flags & WLAN_STA_GAS ? "[GAS]" : ""),
- (sta->flags & WLAN_STA_VHT ? "[VHT]" : ""),
- (sta->flags & WLAN_STA_WNM_SLEEP_MODE ?
- "[WNM_SLEEP_MODE]" : ""),
+ flags,
sta->capability,
sta->listen_interval);
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 4125fd5..0d46ea0 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -56,12 +56,22 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
}
len = 0;
- ret = os_snprintf(buf + len, buflen - len, MACSTR "\n",
+ ret = os_snprintf(buf + len, buflen - len, MACSTR "\nflags=",
MAC2STR(sta->addr));
if (ret < 0 || (size_t) ret >= buflen - len)
return len;
len += ret;
+ ret = ap_sta_flags_txt(sta->flags, buf + len, buflen - len);
+ if (ret < 0)
+ return len;
+ len += ret;
+
+ ret = os_snprintf(buf + len, buflen - len, "\n");
+ if (ret < 0 || (size_t) ret >= buflen - len)
+ return len;
+ len += ret;
+
res = ieee802_11_get_mib_sta(hapd, sta, buf + len, buflen - len);
if (res >= 0)
len += res;
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index c4a0a86..4592cc8 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -1011,3 +1011,33 @@ void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta)
eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
ap_sta_disassoc_cb_timeout(hapd, sta);
}
+
+
+int ap_sta_flags_txt(u32 flags, char *buf, size_t buflen)
+{
+ int res;
+
+ buf[0] = '\0';
+ res = os_snprintf(buf, buflen, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+ (flags & WLAN_STA_AUTH ? "[AUTH]" : ""),
+ (flags & WLAN_STA_ASSOC ? "[ASSOC]" : ""),
+ (flags & WLAN_STA_AUTHORIZED ? "[AUTHORIZED]" : ""),
+ (flags & WLAN_STA_PENDING_POLL ? "[PENDING_POLL" :
+ ""),
+ (flags & WLAN_STA_SHORT_PREAMBLE ?
+ "[SHORT_PREAMBLE]" : ""),
+ (flags & WLAN_STA_PREAUTH ? "[PREAUTH]" : ""),
+ (flags & WLAN_STA_WMM ? "[WMM]" : ""),
+ (flags & WLAN_STA_MFP ? "[MFP]" : ""),
+ (flags & WLAN_STA_WPS ? "[WPS]" : ""),
+ (flags & WLAN_STA_MAYBE_WPS ? "[MAYBE_WPS]" : ""),
+ (flags & WLAN_STA_WDS ? "[WDS]" : ""),
+ (flags & WLAN_STA_NONERP ? "[NonERP]" : ""),
+ (flags & WLAN_STA_WPS2 ? "[WPS2]" : ""),
+ (flags & WLAN_STA_GAS ? "[GAS]" : ""),
+ (flags & WLAN_STA_VHT ? "[VHT]" : ""),
+ (flags & WLAN_STA_WNM_SLEEP_MODE ?
+ "[WNM_SLEEP_MODE]" : ""));
+
+ return res;
+}
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index 925d35f..9b77e06 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -193,4 +193,6 @@ static inline int ap_sta_is_authorized(struct sta_info *sta)
void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta);
void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta);
+int ap_sta_flags_txt(u32 flags, char *buf, size_t buflen);
+
#endif /* STA_INFO_H */