GAS: Replenish AP station session timer to 5 seconds
authorKyeyoon Park <kyeyoonp@qca.qualcomm.com>
Wed, 6 Nov 2013 21:20:28 +0000 (13:20 -0800)
committerJouni Malinen <j@w1.fi>
Thu, 7 Nov 2013 22:22:32 +0000 (00:22 +0200)
If remaining AP session timeout is less than 5 seconds
for an existing station, replenish the timeout to 5 seconds.
This allows stations to be able to recycle a dialog token
value beyond 5 seconds for GAS exchange.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/ap/gas_serv.c
src/ap/sta_info.c
src/ap/sta_info.h

index b3574ba..8349c4d 100644 (file)
@@ -46,6 +46,8 @@ gas_dialog_create(struct hostapd_data *hapd, const u8 *addr, u8 dialog_token)
                 * it to be that long.
                 */
                ap_sta_session_timeout(hapd, sta, 5);
+       } else {
+               ap_sta_replenish_timeout(hapd, sta, 5);
        }
 
        if (sta->gas_dialog == NULL) {
index 016b9b6..a6775f3 100644 (file)
@@ -490,6 +490,18 @@ static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx)
 }
 
 
+void ap_sta_replenish_timeout(struct hostapd_data *hapd, struct sta_info *sta,
+                             u32 session_timeout)
+{
+       if (eloop_replenish_timeout(session_timeout, 0,
+                                   ap_handle_session_timer, hapd, sta)) {
+               hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+                              HOSTAPD_LEVEL_DEBUG, "setting session timeout "
+                              "to %d seconds", session_timeout);
+       }
+}
+
+
 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
                            u32 session_timeout)
 {
index 197e46b..dc74219 100644 (file)
@@ -162,6 +162,8 @@ void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta);
 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
 void hostapd_free_stas(struct hostapd_data *hapd);
 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx);
+void ap_sta_replenish_timeout(struct hostapd_data *hapd, struct sta_info *sta,
+                             u32 session_timeout);
 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
                            u32 session_timeout);
 void ap_sta_no_session_timeout(struct hostapd_data *hapd,