Make EAPOL dump data available through ctrl_iface STA command
The per-STA/Supplicant state information from the EAPOL authenticator is now available through "STA <MAC Address> eapol" command. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
96ea74b866
commit
ea23df652a
2 changed files with 31 additions and 12 deletions
|
@ -281,11 +281,14 @@ static void hostapd_cli_action_process(char *msg, size_t len)
|
||||||
static int hostapd_cli_cmd_sta(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
static int hostapd_cli_cmd_sta(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
if (argc != 1) {
|
if (argc < 1) {
|
||||||
printf("Invalid 'sta' command - exactly one argument, STA "
|
printf("Invalid 'sta' command - at least one argument, STA "
|
||||||
"address, is required.\n");
|
"address, is required.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (argc > 1)
|
||||||
|
snprintf(buf, sizeof(buf), "STA %s %s", argv[0], argv[1]);
|
||||||
|
else
|
||||||
snprintf(buf, sizeof(buf), "STA %s", argv[0]);
|
snprintf(buf, sizeof(buf), "STA %s", argv[0]);
|
||||||
return wpa_ctrl_command(ctrl, buf);
|
return wpa_ctrl_command(ctrl, buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include "utils/common.h"
|
#include "utils/common.h"
|
||||||
#include "common/ieee802_11_defs.h"
|
#include "common/ieee802_11_defs.h"
|
||||||
|
#include "eapol_auth/eapol_auth_sm.h"
|
||||||
#include "hostapd.h"
|
#include "hostapd.h"
|
||||||
#include "ieee802_1x.h"
|
#include "ieee802_1x.h"
|
||||||
#include "wpa_auth.h"
|
#include "wpa_auth.h"
|
||||||
|
@ -85,13 +86,6 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
|
||||||
{
|
{
|
||||||
int len, res, ret, i;
|
int len, res, ret, i;
|
||||||
|
|
||||||
if (sta == NULL) {
|
|
||||||
ret = os_snprintf(buf, buflen, "FAIL\n");
|
|
||||||
if (ret < 0 || (size_t) ret >= buflen)
|
|
||||||
return 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
ret = os_snprintf(buf + len, buflen - len, MACSTR "\nflags=",
|
ret = os_snprintf(buf + len, buflen - len, MACSTR "\nflags=",
|
||||||
MAC2STR(sta->addr));
|
MAC2STR(sta->addr));
|
||||||
|
@ -162,6 +156,8 @@ int hostapd_ctrl_iface_sta(struct hostapd_data *hapd, const char *txtaddr,
|
||||||
{
|
{
|
||||||
u8 addr[ETH_ALEN];
|
u8 addr[ETH_ALEN];
|
||||||
int ret;
|
int ret;
|
||||||
|
const char *pos;
|
||||||
|
struct sta_info *sta;
|
||||||
|
|
||||||
if (hwaddr_aton(txtaddr, addr)) {
|
if (hwaddr_aton(txtaddr, addr)) {
|
||||||
ret = os_snprintf(buf, buflen, "FAIL\n");
|
ret = os_snprintf(buf, buflen, "FAIL\n");
|
||||||
|
@ -169,8 +165,28 @@ int hostapd_ctrl_iface_sta(struct hostapd_data *hapd, const char *txtaddr,
|
||||||
return 0;
|
return 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return hostapd_ctrl_iface_sta_mib(hapd, ap_get_sta(hapd, addr),
|
|
||||||
buf, buflen);
|
sta = ap_get_sta(hapd, addr);
|
||||||
|
if (sta == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
pos = os_strchr(txtaddr, ' ');
|
||||||
|
if (pos) {
|
||||||
|
pos++;
|
||||||
|
|
||||||
|
#ifdef HOSTAPD_DUMP_STATE
|
||||||
|
if (os_strcmp(pos, "eapol") == 0) {
|
||||||
|
if (sta->eapol_sm == NULL)
|
||||||
|
return -1;
|
||||||
|
return eapol_auth_dump_state(sta->eapol_sm, buf,
|
||||||
|
buflen);
|
||||||
|
}
|
||||||
|
#endif /* HOSTAPD_DUMP_STATE */
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hostapd_ctrl_iface_sta_mib(hapd, sta, buf, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue