Stale sessions and mac auth problem

Alan DeKok aland at deployingradius.com
Fri Dec 13 15:24:44 CET 2013


Peter wrote:
> I'm using Coova and Freeradius and I have the entry below to clear stale
> sessions when a user logs in. I'm using freeradius version 2.1.10 and I
> got the code below from a previous email in this list.

  It would be preferred to understand the code, too.

> if(User-Name){
>         if("%{sql:UPDATE radacct set
> AcctStopTime=ADDDATE(AcctStartTime,INTERVAL AcctSessionTime SECOND),
> AcctTerminateCause='Clear-Stale Session' WHERE UserName='%{User-Name}'
> and CallingStationId='%{Calling-Station-Id}' and AcctStopTime is NULL}"){
>         reject
>         }
> }
> The code above works perfectly for normal users signing in by clearing
> the stale session on the first attempt and the user tries again and can
> log in. My problem is when it's a mac auth request Coova sends the
> request at least twice. This causes the device to log in on the first
> request and then out on the second request. So how could I change the
> empty if statement "if(User-Name)" to only run this if the the username
> is not a mac address "if(User-Name != macaddress)"

  1) write down what a MAC address looks like.  See "radiusd -X"
     for examples

  2) write a comparison using unlang.  See "man unlang".

  And no, out of general principle, I'm not going to cut & paste the
answers here.  The answers exist in the documentation and examples.

  Alan DeKok.


More information about the Freeradius-Users mailing list