mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-29 08:14:02 -05:00
Include connected time in AP mode STA-* commands
This allows hostapd_cli and wpa_cli all_sta command to be used to display connected time (in seconds) of each station in AP mode. Signed-hostap: Raja Mani <rmani@qca.qualcomm.com>
This commit is contained in:
parent
213c1fa84d
commit
39b1572c41
@ -21,6 +21,28 @@
|
|||||||
#include "ap_drv_ops.h"
|
#include "ap_drv_ops.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int hostapd_get_sta_conn_time(struct sta_info *sta,
|
||||||
|
char *buf, size_t buflen)
|
||||||
|
{
|
||||||
|
struct os_time now, age;
|
||||||
|
int len = 0, ret;
|
||||||
|
|
||||||
|
if (!sta->connected_time.sec)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
os_get_time(&now);
|
||||||
|
os_time_sub(&now, &sta->connected_time, &age);
|
||||||
|
|
||||||
|
ret = os_snprintf(buf + len, buflen - len, "connected_time=%u\n",
|
||||||
|
(unsigned int) age.sec);
|
||||||
|
if (ret < 0 || (size_t) ret >= buflen - len)
|
||||||
|
return len;
|
||||||
|
len += ret;
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
|
static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
|
||||||
struct sta_info *sta,
|
struct sta_info *sta,
|
||||||
char *buf, size_t buflen)
|
char *buf, size_t buflen)
|
||||||
@ -58,6 +80,10 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
|
|||||||
if (res >= 0)
|
if (res >= 0)
|
||||||
len += res;
|
len += res;
|
||||||
|
|
||||||
|
res = hostapd_get_sta_conn_time(sta, buf + len, buflen - len);
|
||||||
|
if (res >= 0)
|
||||||
|
len += res;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1373,8 +1373,10 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
|
|||||||
/* Start accounting here, if IEEE 802.1X and WPA are not used.
|
/* Start accounting here, if IEEE 802.1X and WPA are not used.
|
||||||
* IEEE 802.1X/WPA code will start accounting after the station has
|
* IEEE 802.1X/WPA code will start accounting after the station has
|
||||||
* been authorized. */
|
* been authorized. */
|
||||||
if (!hapd->conf->ieee802_1x && !hapd->conf->wpa)
|
if (!hapd->conf->ieee802_1x && !hapd->conf->wpa) {
|
||||||
|
os_get_time(&sta->connected_time);
|
||||||
accounting_sta_start(hapd, sta);
|
accounting_sta_start(hapd, sta);
|
||||||
|
}
|
||||||
|
|
||||||
/* Start IEEE 802.1X authentication process for new stations */
|
/* Start IEEE 802.1X authentication process for new stations */
|
||||||
ieee802_1x_new_station(hapd, sta);
|
ieee802_1x_new_station(hapd, sta);
|
||||||
|
@ -99,8 +99,10 @@ void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd,
|
|||||||
"driver (errno=%d).\n", MAC2STR(sta->addr), errno);
|
"driver (errno=%d).\n", MAC2STR(sta->addr), errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authorized)
|
if (authorized) {
|
||||||
|
os_get_time(&sta->connected_time);
|
||||||
accounting_sta_start(hapd, sta);
|
accounting_sta_start(hapd, sta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,6 +121,8 @@ struct sta_info {
|
|||||||
|
|
||||||
struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
|
struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
|
||||||
struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
|
struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
|
||||||
|
|
||||||
|
struct os_time connected_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user