Modifying FreeRADIUS queries [from the wiki]

Jeff Wark jeff at
Thu Mar 11 17:12:55 CET 2010

I apologize if this is a trivial question, but I cannot find an explanation regarding my specific question.

I have seen the following entry in the wiki regarding taking into account Gigawords:

Modify FreeRADIUS Queries

Secondly, modify the accounting queries in sql.conf to make the SQL database perform the computation that is required to merge the 
two values sent as attributes by the NAS into one single 64-bit integer stored in the database.

All occurrences of '%{Acct-Input-Octets}' need to be replaced with:
'%{Acct-Input-Gigawords:-0}'  << 32 | '%{Acct-Input-Octets:-0}'

The same thing needs to be done for '%{Acct-Output-Octets}':
'%{Acct-Output-Gigawords:-0}'  << 32 | '%{Acct-Output-Octets:-0}'

I understand the left shifting of the Gigawords value and the subsequent 'or'-ing of the Acct-Input-Octets value to produce one 
64-bit value.  The part that confuses me is the repeated occurrence of the ':-0' at the end of each variable.  What is the purpose 
of this?  I have seen it on other pages used with other variable substitutions.  I have also seen the above Gigawords entry done 
without the ':-0' [only once though].  I would rather understand the purpose behind the entry rather than blindly copying it.

If there is a wiki page or FAQ entry that I have missed regarding this syntax, I would love to know about it.

Thanks for the input.

-Jeff Wark

More information about the Freeradius-Users mailing list