Dynamic session timeout

Sam T givemesam at gmail.com
Sat Nov 10 02:30:26 CET 2018


Hi Alan

First off, Thanks so much for the reply! I think there was some delay in my
last email sending, so I sent an abridged follow up which you replied to
not seeing the debug info.

Here is the entire message with the output. Let me know if there is
something more you need to see. I am very excited to get this working :)

----

So if this expression is indeed corrected now, i guess my question lies
with how to handle the output? Take a look

   if (reply:WISPr-Session-Terminate-Time) {
            update reply {

         Session-Timeout :=
"%{expr:%{integer:reply:WISPr-Session-Terminate-Time} - %l}"
            }
        }

# this returns

User-Password in the request is correct.
Login OK: [22-22-22-22-22-11/password] (from client wificpa port 0)
# Executing section post-auth from file
/etc/freeradius/sites-enabled/wifirush.rad
+- entering group post-auth {...}
++? if (reply:WISPr-Session-Terminate-Time)
? Evaluating (reply:WISPr-Session-Terminate-Time) -> TRUE
++? if (reply:WISPr-Session-Terminate-Time) -> TRUE
++- entering if (reply:WISPr-Session-Terminate-Time) {...}
        expand: %{integer:reply:WISPr-Session-Terminate-Time} - %l ->  -
1541810370
        expand: %{expr:%{integer:reply:WISPr-Session-Terminate-Time} - %l}
-> -1541810370
+++[reply] returns noop
++- if (reply:WISPr-Session-Terminate-Time) returns noop
Sending Access-Accept of id 148 to 96.227.97.217 port 52831
        WISPr-Bandwidth-Max-Up = 5000000
        WISPr-Bandwidth-Max-Down = 5000000
        Mikrotik-Rate-Limit = ""
        Acct-Interim-Interval = 300
        Session-Timeout = 2753156926
        Idle-Timeout = 900
        WISPr-Session-Terminate-Time = "2018-12-02T12:22:23+00:00"
Finished request 1.
Going to the next request
Waking up in 4.9 seconds.
Cleaning up request 1 ID 148 with timestamp +13
Ready to process requests.

#############

Here is a debug rule with what we are trying to do that will output the two
values we are interested in doing math on ....

 if (reply:WISPr-Session-Terminate-Time) {
            update reply {

        Session-Timeout :=
"%{expr:%{integer:reply:WISPr-Session-Terminate-Time} - %l}"
        Reply-Message := "Now Value is %l AND Debug-SessionTimeoutInt is
"%{integer:reply:WISPr-Session-Terminate-Time}"
            }
        }

Login OK: [22-22-22-22-22-11/password] (from client wificpa port 0)
# Executing section post-auth from file
/etc/freeradius/sites-enabled/wifirush.rad
+- entering group post-auth {...}
++? if (reply:WISPr-Session-Terminate-Time)
? Evaluating (reply:WISPr-Session-Terminate-Time) -> TRUE
++? if (reply:WISPr-Session-Terminate-Time) -> TRUE
++- entering if (reply:WISPr-Session-Terminate-Time) {...}
        expand: %{integer:reply:WISPr-Session-Terminate-Time} - %l ->  -
1541810786
        expand: %{expr:%{integer:reply:WISPr-Session-Terminate-Time} - %l}
-> -1541810786
        expand: Now Value is %l AND Debug-SessionTimeoutInt is  -> Now
Value is 1541810786 AND Debug-SessionTimeoutInt is
+++[reply] returns noop
++- if (reply:WISPr-Session-Terminate-Time) returns noop
Sending Access-Accept of id 151 to 96.227.97.217 port 53014
        WISPr-Bandwidth-Max-Up = 5000000
        WISPr-Bandwidth-Max-Down = 5000000
        Mikrotik-Rate-Limit = ""
        Acct-Interim-Interval = 300
        Session-Timeout = 2753156510
        Idle-Timeout = 900
        WISPr-Session-Terminate-Time = "2018-12-02T12:22:23+00:00"
        Reply-Message = "Now Value is 1541810786 AND
Debug-SessionTimeoutInt is "
Finished request 2.
Going to the next request

-----

I think the issue is handling this
 Reply-Message = "Now Value is 1541810786 AND Debug-SessionTimeoutInt is "

Shows that  %l = 1541810786
%{integer:reply:WISPr-Session-Terminate-Time} = NULL
%{integer:reply:WISPr-Session-Terminate-Time} should result in some integer

Then, we will need to convert the final value into seconds, and not as
compared to epoch, if that is what it is outputting vs the actual session
timout :)

Any additional direction on how to handle the output, if correct, would be
greatly appreciated.

On Fri, Nov 9, 2018 at 10:50 AM Alan DeKok <aland at deployingradius.com>
wrote:

>
>
> > On Nov 7, 2018, at 4:09 PM, Sam T <givemesam at gmail.com> wrote:
> >
> > Hi all
> >
> > Can I get some help to interpret the output value from
> > %{expr:%{integer:reply:WISPr-Session-Terminate-Time} - %l}
> >
> > the value being returned is not what we are expecting / Session-Timeout =
> > 2753857926
> >
> > is the unlang or output erroneous or is it in some epoch related time?
>
>   It's impossible to tell without seeing the debug output.
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list