Captiveportal idle timeout

  • Thinking about the logout with captiveportal, as I dont enable popup windows!

    I was wondering if I can get the idle timeout to work as alternative but I was concerned that most PC's send some traffic even when idle, hence I submise they will continue to register as NOT idle even if they are just sitting their. Checking the, I note the following code block

    function captiveportal_get_last_activity($ip, $mac = NULL, $table = 1) {
       global $cpzoneid;
       /* XXX Fix */
       return 0;
       $ipfwoutput = pfSense_ipfw_getTablestats($cpzoneid, IP_FW_TABLE_XLISTENTRY, $table, $ip, $mac);
       /* Reading only from one of the tables is enough of approximation. */
       if (is_array($ipfwoutput)) {
          /* Workaround for #46652 */
          if ($ipfwoutput['packets'] > 0) {
             return $ipfwoutput['timestamp'];
          } else {
             return 0;

    Would it make sense to change the threshold from 0 to say 5 (or some other number based on trial and error), so for example

    if ($ipfwoutput['packets'] > 5) {

    meaning the user would need to send more than 5 packets to generate a timestamp. Could this threshold be a variable and added to gui as variable you can tweak.?

    I had another alternative, where the user can select the hardtime out time at the beginning of their session. So when captive portal authentication page is shown, the user can also select from a drop down  of session times (say in 5 minute increments). The user would select the appropriate time up to a maximum value afterwhich they would be automatically disconnected leaving the remainder of their daily allowance (controlled by freeRadius) unused ready for the next session.

    I did try custom logout page option, which worked somewhat OK, but this did not entirely work as intended, as it impacted the login as well, where the user needed manually open another tab to connect to the website of their choice. I lack the php skills needed to get the redirection in the header working properly.

    I am using 2.3 and relatively NEW to php  :-[.

    thanks in anticipation

Log in to reply