Setting Reply Attributes Based on Time of Day?

Palmer J.D.F. J.D.F.Palmer at swansea.ac.uk
Thu Feb 23 20:43:45 CET 2012


> Hi,
> 
> > Is there a function within FR to schedule certain attributes to be
> > returned in the Access-Accept reply?
> >
> > Essentially we return a QoS VSA along with VLAN information on a
> > successful auth, however between certain times of day there is more
> > available bandwidth so to be kind to our users we'd like to return a
> > different QoS level to during these bandwidth abundant periods.
> > Does such a mechanism exist?
> 
> 
> bit of unlang with some checks against internal variables....you can
> check
> the hour of the day, for example...and then change the reply..
> 
> ...hmm, are the variables valid there?
> 
> if ( %H > 20 ){
>  'give them more bandwidth'
> }
> 

Excellent, thanks for the point in the right direction, Alan.
The %H variable is a string so wouldn't enumerate as above, so have done
this...

if ( "%H" =~ /(02|03|04|05|06|07|08)/ ){
  update reply {
    Airespace-QOS-Level = "2"
  }
}

Not particularly elegant, but is doing the job.  
Would there be a more efficient way to do that?

And finally, is there an internal variable for day of the week?

Cheers,
Jezz.




More information about the Freeradius-Users mailing list