help-gnu-radius
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gnu-radius] Cisco VSA AV-Pair Attribute Issue


From: Sergey Poznyakoff
Subject: Re: [Help-gnu-radius] Cisco VSA AV-Pair Attribute Issue
Date: Sun, 27 Apr 2003 14:11:40 +0300

Hi Lewis,

Here's the problem:
> ATTRIBUTE       nas-tx-speed    26      string  Cisco

The 'nas-tx-speed' is not actually an attribute. It is a value packed
into the Cisco-AVPair attribute as you may see in your log:

>         Cisco-AVPair = nas-tx-speed=26400

In other words, the value of Cisco-AVPair is a string of the form
NAME=VALUE. What you actually need is to select such attribute
that has string "nas-tx-speed" in the NAME part and store its VALUE
to the database. You will have to use Rewrite language to do so.
Here is the short instruction:

1) Define a new attribute for keeping nas-tx-speed value. You
will probably need more custom attributes, so it will make sense
to add them all to a spearate file. Let's suppose the file is
/etc/raddb/dict/custom. Add the following line to it:

ATTRIBUTE Custom-NAS-TX-Speed        3000    integer

The exact numeric value of the attribute is at your option, the
only requirement being that it not coincide with any existing
attribute.

2) Now, include this file to your main dictionary. Add the following line
to raddb/dictionary:

$INCLUDE dict/custom

3) Next, write a function that will create this attribute. Add the
following to your raddb/rewrite:

integer
parse_cisco_avpair()
{
        if (*%[Cisco-AVPair]
            && %[Cisco-AVPair] =~ "nas-tx-speed=\(.*\)")
                %[Custom-NAS-TX-Speed] = \1;
}

4) Configure this function to be invoked for each packet. To your
raddb/hints add:

DEFAULT     Rewrite-Function = parse_cisco_avpair       NULL

5) Change the acct_stop_query to make use of the new attribute:

acct_stop_query      UPDATE calls \
                     SET status=%C{Acct-Status-Type},\
                         acct_session_time=%C{Acct-Session-Time},\
                         acct_input_octets=%C{Acct-Input-Octets},\
                         acct_output_octets=%C{Acct-Output-Octets},\
                         connect_term_reason=%C{Acct-Terminate-Cause},\
                        connect_speed='%C{Custom-NAS-TX-Speed}' \
                        WHERE user_name='%C{User-Name}' \
                       AND status = 1 \
                       AND acct_session_id='%C{Acct-Session-Id}'

And, finally, do `radctl reload'.

Regards,
Sergey













reply via email to

[Prev in Thread] Current Thread [Next in Thread]