diff options
author | Jouni Malinen <j@w1.fi> | 2015-09-05 14:11:11 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2015-09-05 14:11:11 (GMT) |
commit | a65a9b8d677b5b3ed9a77f5fe3a3fa6bc34e5d32 (patch) | |
tree | ee3504b4fc463b37b130881a578351c12934b7c9 /hostapd | |
parent | 6ebe816be00702904332744547180bdb27b126f3 (diff) | |
download | hostap-a65a9b8d677b5b3ed9a77f5fe3a3fa6bc34e5d32.zip hostap-a65a9b8d677b5b3ed9a77f5fe3a3fa6bc34e5d32.tar.gz hostap-a65a9b8d677b5b3ed9a77f5fe3a3fa6bc34e5d32.tar.bz2 |
hostapd: Add mechanism to track unconnected stations
hostapd can now be configured to track unconnected stations based on
Probe Request frames seen from them. This can be used, e.g., to detect
dualband capable station before they have associated. Such information
could then be used to provide guidance on which colocated BSS to use in
case of a dualband AP that operates concurrently on multiple bands under
the control of a single hostapd process.
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'hostapd')
-rw-r--r-- | hostapd/config_file.c | 4 | ||||
-rw-r--r-- | hostapd/ctrl_iface.c | 38 | ||||
-rw-r--r-- | hostapd/hostapd.conf | 9 |
3 files changed, 51 insertions, 0 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c index e91c86c..336eba9 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -3399,6 +3399,10 @@ static int hostapd_config_fill(struct hostapd_config *conf, } conf->fst_cfg.llt = (u32) val; #endif /* CONFIG_FST */ + } else if (os_strcmp(buf, "track_sta_max_num") == 0) { + conf->track_sta_max_num = atoi(pos); + } else if (os_strcmp(buf, "track_sta_max_age") == 0) { + conf->track_sta_max_age = atoi(pos); } else { wpa_printf(MSG_ERROR, "Line %d: unknown configuration item '%s'", diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 306c53c..cb6fb17 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -2007,6 +2007,39 @@ static int hostapd_ctrl_iface_log_level(struct hostapd_data *hapd, char *cmd, } +#ifdef NEED_AP_MLME +static int hostapd_ctrl_iface_track_sta_list(struct hostapd_data *hapd, + char *buf, size_t buflen) +{ + struct hostapd_iface *iface = hapd->iface; + char *pos, *end; + struct hostapd_sta_info *info; + struct os_reltime now; + + sta_track_expire(iface, 0); + + pos = buf; + end = buf + buflen; + + os_get_reltime(&now); + dl_list_for_each_reverse(info, &iface->sta_seen, + struct hostapd_sta_info, list) { + struct os_reltime age; + int ret; + + os_reltime_sub(&now, &info->last_seen, &age); + ret = os_snprintf(pos, end - pos, MACSTR " %u\n", + MAC2STR(info->addr), (unsigned int) age.sec); + if (os_snprintf_error(end - pos, ret)) + break; + pos += ret; + } + + return pos - buf; +} +#endif /* NEED_AP_MLME */ + + static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, char *buf, char *reply, int reply_size, @@ -2238,6 +2271,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, } else if (os_strncmp(buf, "LOG_LEVEL", 9) == 0) { reply_len = hostapd_ctrl_iface_log_level( hapd, buf + 9, reply, reply_size); +#ifdef NEED_AP_MLME + } else if (os_strcmp(buf, "TRACK_STA_LIST") == 0) { + reply_len = hostapd_ctrl_iface_track_sta_list( + hapd, reply, reply_size); +#endif /* NEED_AP_MLME */ } else { os_memcpy(reply, "UNKNOWN COMMAND\n", 16); reply_len = 16; diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index 4a829ea..d912197 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -1279,6 +1279,15 @@ own_ip_addr=127.0.0.1 # default: 60 #ap_table_expiration_time=3600 +# Maximum number of stations to track on the operating channel +# This can be used to detect dualband capable stations before they have +# associated, e.g., to provide guidance on which colocated BSS to use. +# Default: 0 (disabled) +#track_sta_max_num=100 + +# Maximum age of a station tracking entry in seconds +# Default: 180 +#track_sta_max_age=180 ##### Wi-Fi Protected Setup (WPS) ############################################# |