[PATCH} Make AP_MAX_INACTIVITY configurable

Ryan Castellucci ryan.castellucci at gmail.com
Thu Mar 16 20:31:32 EST 2006


This patch applies fine on 0.4.8. It adds the config file option
'max_inactivity'.

----- CUT HERE ----
diff -u hostapd-0.3.7/config.c hostap/config.c
--- hostapd-0.3.7/config.c      2005-01-22 11:43:16.000000000 -0800
+++ hostap/config.c     2006-03-07 16:29:46.000000000 -0800
@@ -65,6 +65,8 @@
        conf->wpa_pairwise = WPA_CIPHER_TKIP;
        conf->wpa_group = WPA_CIPHER_TKIP;

+       conf->max_inactivity = AP_MAX_INACTIVITY;
+
        conf->radius_server_auth_port = 1812;

        return conf;
@@ -681,6 +683,8 @@
                        conf->logger_stdout = atoi(pos);
                } else if (strcmp(buf, "dump_file") == 0) {
                        conf->dump_log_name = strdup(pos);
+               } else if (strcmp(buf, "max_inactivity") == 0) {
+                       conf->max_inactivity = atoi(pos);
                } else if (strcmp(buf, "ssid") == 0) {
                        conf->ssid_len = strlen(pos);
                        if (conf->ssid_len >= HOSTAPD_SSID_LEN ||
diff -u hostapd-0.3.7/config.h hostap/config.h
--- hostapd-0.3.7/config.h      2005-01-11 17:58:20.000000000 -0800
+++ hostap/config.h     2006-03-07 16:29:46.000000000 -0800
@@ -102,6 +102,8 @@
                                * EAP Request-Identity */
        int eapol_key_index_workaround;

+       u32 max_inactivity;
+
        size_t default_wep_key_len;
        int individual_wep_key_len;
        int wep_rekeying_period;
diff -u hostapd-0.3.7/sta_info.c hostap/sta_info.c
--- hostapd-0.3.7/sta_info.c    2004-11-26 19:33:13.000000000 -0800
+++ hostap/sta_info.c   2006-03-07 16:29:46.000000000 -0800
@@ -178,13 +178,13 @@
                        printf("  Could not get station info from kernel "
                               "driver for " MACSTR ".\n",
                               MAC2STR(sta->addr));
-               } else if (inactive_sec < AP_MAX_INACTIVITY &&
+               } else if (inactive_sec < hapd->conf->max_inactivity &&
                           sta->flags & WLAN_STA_ASSOC) {
                        /* station activity detected; reset timeout state */
                        HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
                                      "  Station has been active\n");
                        sta->timeout_next = STA_NULLFUNC;
-                       next_time = AP_MAX_INACTIVITY - inactive_sec;
+                       next_time = hapd->conf->max_inactivity - inactive_sec;
                }
        }

@@ -196,7 +196,7 @@
                /* data nullfunc frame poll did not produce TX errors; assume
                 * station ACKed it */
                sta->timeout_next = STA_NULLFUNC;
-               next_time = AP_MAX_INACTIVITY;
+               next_time = hapd->conf->max_inactivity;
        }

        if (next_time) {
@@ -342,7 +342,7 @@
        sta->acct_interim_interval = hapd->conf->radius_acct_interim_interval;

        /* initialize STA info data */
-       eloop_register_timeout(AP_MAX_INACTIVITY, 0, ap_handle_timer,
+       eloop_register_timeout(hapd->conf->max_inactivity, 0, ap_handle_timer,
                               hapd, sta);
        memcpy(sta->addr, addr, ETH_ALEN);
        sta->next = hapd->sta_list;
---- END CUT ----



More information about the HostAP mailing list