[PATCH] Remove inactivity timeout for wired interfaces

Sam Tannous stannous at cumulusnetworks.com
Mon Oct 17 15:02:16 PDT 2016


We should unconditionally remove inactivity timers for wired network cases.
This patch checks for this after a new station association:

   hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED

and then cancels the timeout and does not register a new one.

It prints out a debug message "cancel wired" like this:

1476740180.276286: IEEE 802.1X: 00:02:00:00:00:07 CTRL_DIR entering
1476740180.276295: hostapd_new_assoc_sta: cancel wired ap_handle_timer
timeout for 00:02:00:00:00:07 (120 seconds - ap_max_inactivity)

This was tested on a debian jessie amd64 system with a configured 120 second
inactivity timer and the session did not timeout.

Sam Tannous
Cumulus Networks

Signed-off-by: Sam Tannous <stannous at cumulusnetworks.com>
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 9fafc7f..1717817 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2834,7 +2834,14 @@ void hostapd_new_assoc_sta(struct hostapd_data
*hapd, struct sta_info *sta,
        } else
                wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm);

-       if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) {
+       if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED) {
+               wpa_printf(MSG_DEBUG,
+                          "%s: %s: cancel wired ap_handle_timer timeout for "
+                          MACSTR " (%d seconds - ap_max_inactivity)",
+                          hapd->conf->iface, __func__, MAC2STR(sta->addr),
+                          hapd->conf->ap_max_inactivity);
+               eloop_cancel_timeout(ap_handle_timer, hapd, sta);
+       } else if (!(hapd->iface->drv_flags &
                           "%s: %s: reschedule ap_handle_timer timeout for "
                           MACSTR " (%d seconds - ap_max_inactivity)",

More information about the Hostap mailing list