Next: Logging Hook Functions, Previous: Login Verification Functions, Up: Rewrite [Contents][Index]
These are the functions used to create Radius reply attributes. An attribute creation function can take any number of arguments. The type of its return is determined by the type of Radius attribute the value will be assigned to. To invoke the function, write its name in the A/V pair of the RHS in the raddb/users file, e.g.:
DEFAULT Auth-Type = SQL
Service-Type = Framed-User,
Framed-IP-Address = "=get_ip_addr(10.10.10.1)"
The function get_ip_addr will be invoked after successful
authentication and it will be passed the IP 10.10.10.1 as its
argument. In Rewrite language, an IPv4 address is
represented as a 32-bit integer number, and can be operated upon as
any other integer. This is illustrated in the following function,
which can be used to compute the value of the Framed-IP-Address
above:
integer
get_ip_address(integer base)
{
return base + %[NAS-Port-Id] - %[NAS-Port-Id]/16;
}