add attribute FreeRADIUS-Client-NAS-Type in req accounting?
hi, how i can add attribute FreeRADIUS-Client-NAS-Type in accounting, i load &FreeRADIUS-Client-NAS-Type = "%{sql: SELECT type FROM nas WHERE host = '%{Packet-Src-IP-Address}'}" from dynamic_clients , and in preacct { update request { &Acct-Unique-Session-Id := "%{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}" &FreeRADIUS-Client-NAS-Type := &control:FreeRADIUS-Client-NAS-Type } } accounting { # ok rest } but in post on rest not see FreeRADIUS-Client-NAS-Type in log Thu Sep 28 21:40:30 2017 : Debug: (324) # Executing section preacct from file /etc/raddb/radiusd.conf Thu Sep 28 21:40:30 2017 : Debug: (324) preacct { Thu Sep 28 21:40:30 2017 : Debug: (324) update request { Thu Sep 28 21:40:30 2017 : Debug: (324) EXPAND %{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}} Thu Sep 28 21:40:30 2017 : Debug: (324) --> 9f7d7ee63b81739f567f5703597b1556 Thu Sep 28 21:40:30 2017 : Debug: (324) &Acct-Unique-Session-Id := 9f7d7ee63b81739f567f5703597b1556 Thu Sep 28 21:40:30 2017 : Debug: (324) No attributes updated Thu Sep 28 21:40:30 2017 : Debug: (324) No attributes updated Thu Sep 28 21:40:30 2017 : Debug: (324) No attributes updated Thu Sep 28 21:40:30 2017 : Debug: (324) } # update request = noop Thu Sep 28 21:40:30 2017 : Debug: (324) } # preacct = noop Thu Sep 28 21:40:30 2017 : Debug: (324) # Executing section accounting from file /etc/raddb/radiusd.conf Thu Sep 28 21:40:30 2017 : Debug: (324) accounting { Thu Sep 28 21:40:30 2017 : Debug: (324) modsingle[accounting]: calling rest (rlm_rest)
On Sep 28, 2017, at 3:35 PM, Dmitry Yashin via Freeradius-Users <freeradius-users@lists.freeradius.org> wrote:
hi, how i can add attribute FreeRADIUS-Client-NAS-Type in accounting, i load
&FreeRADIUS-Client-NAS-Type = "%{sql: SELECT type FROM nas WHERE host = '%{Packet-Src-IP-Address}'}"
from dynamic_clients ,
That only gets used when defining the dynamic client. It's not available elsewhere/
and in
preacct { update request { &Acct-Unique-Session-Id := "%{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}" &FreeRADIUS-Client-NAS-Type := &control:FreeRADIUS-Client-NAS-Type
Just do the SQL SELECT again: &FreeRADIUS-Client-NAS-Type = "%{sql: SELECT type FROM nas WHERE host = '%{Packet-Src-IP-Address}'}" Alan DeKok.
it's slow ... can some trick ? like in dynamic client tmp { type.'%{Packet-Src-IP-Address}' = %{FreeRADIUS-Client-NAS-Type} } and use tmp.type.'%{Packet-Src-IP-Address}' in pre-acct ? пт, 29 сент. 2017 г. в 1:02, Alan DeKok <aland@deployingradius.com>:
On Sep 28, 2017, at 3:35 PM, Dmitry Yashin via Freeradius-Users < freeradius-users@lists.freeradius.org> wrote:
hi, how i can add attribute FreeRADIUS-Client-NAS-Type in accounting, i load
&FreeRADIUS-Client-NAS-Type = "%{sql: SELECT type FROM nas WHERE host = '%{Packet-Src-IP-Address}'}"
from dynamic_clients ,
That only gets used when defining the dynamic client. It's not available elsewhere/
and in
preacct { update request { &Acct-Unique-Session-Id :=
"%{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}"
&FreeRADIUS-Client-NAS-Type := &control:FreeRADIUS-Client-NAS-Type
Just do the SQL SELECT again:
&FreeRADIUS-Client-NAS-Type = "%{sql: SELECT type FROM nas WHERE host = '%{Packet-Src-IP-Address}'}"
Alan DeKok.
On Oct 1, 2017, at 7:14 AM, Dmitry Yashin via Freeradius-Users <freeradius-users@lists.freeradius.org> wrote:
it's slow ... can some trick ? like
in dynamic client tmp { type.'%{Packet-Src-IP-Address}' = %{FreeRADIUS-Client-NAS-Type} }
and use tmp.type.'%{Packet-Src-IP-Address}' in pre-acct ?
You can't do that. Just store Packet-Src-IP-Address, and do NAS type lookups later. Alan DeKok.
participants (2)
-
Alan DeKok -
Dmitry Yashin