From: Vasanthakumar Thiagarajan Date: Tue, 27 Mar 2012 17:45:23 +0000 (+0300) Subject: nl80211: Make use of driver's capability to detect inactive stations X-Git-Tag: hostap_2_0~792 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=a0133ee1c96db7436179d15f64e18e5165c4ab8c;p=mech_eap.git nl80211: Make use of driver's capability to detect inactive stations When drivers advertise their capability to free up inactive stations based on ap_max_inactivity, send the inactivity period timeout to driver in NL80211_ATTR_INACTIVITY_TIMEOUT. This introduces a WPA_DRIVER_FLAGS (WPA_DRIVER_FLAGS_INACTIVITY_TIMER) so that the inactivity period will be sent only when this capability bit is set. Signed-hostap: Vasanthakumar Thiagarajan --- diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 4ea8684..5efa4cd 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -682,6 +682,7 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd) !is_zero_ether_addr(hapd->conf->hessid)) params.hessid = hapd->conf->hessid; params.access_network_type = hapd->conf->access_network_type; + params.ap_max_inactivity = hapd->conf->ap_max_inactivity; if (hostapd_drv_set_ap(hapd, ¶ms)) wpa_printf(MSG_ERROR, "Failed to set beacon parameters"); hostapd_free_ap_extra_ies(hapd, beacon, proberesp, assocresp); diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 04aedcf..6eb0421 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -707,6 +707,13 @@ struct wpa_driver_ap_params { * enabled. */ u8 access_network_type; + + /** + * ap_max_inactivity - Timeout in seconds to detect STA's inactivity + * + * This is used by driver which advertises this capability. + */ + int ap_max_inactivity; }; /** @@ -790,6 +797,8 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD 0x00200000 /* Driver supports U-APSD in AP mode */ #define WPA_DRIVER_FLAGS_AP_UAPSD 0x00400000 +/* Driver supports inactivity timer in AP mode */ +#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER 0x00800000 unsigned int flags; int max_scan_ssids; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 74865f3..94fbca1 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -2512,6 +2512,9 @@ broken_combination: if (flags & NL80211_FEATURE_SK_TX_STATUS) info->data_tx_status = 1; + + if (flags & NL80211_FEATURE_INACTIVITY_TIMER) + capa->flags |= WPA_DRIVER_FLAGS_INACTIVITY_TIMER; } if (tb[NL80211_ATTR_PROBE_RESP_OFFLOAD]) { @@ -5415,6 +5418,11 @@ static int wpa_driver_nl80211_set_ap(void *priv, wpabuf_head(params->assocresp_ies)); } + if (drv->capa.flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER) { + NLA_PUT_U16(msg, NL80211_ATTR_INACTIVITY_TIMEOUT, + params->ap_max_inactivity); + } + ret = send_and_recv_msgs(drv, msg, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",