FreeRADIUS / freeradius-server

FreeRADIUS - A multi-protocol policy server.
http://freeradius.org
GNU General Public License v2.0
2.13k stars 1.08k forks source link

[defect]: radacct: missing Delegated-IPv6-Prefix in radacct sql table and detail logs, but ipv6 full-working. #5275

Closed AlexIT-FT closed 9 months ago

AlexIT-FT commented 9 months ago

What type of defect/bug is this?

Unexpected behaviour (obvious or verified by project member)

How can the issue be reproduced?

os : linux ubuntu 22.04 version : freeradius 3.0.26 module enabled : sql (mysql) + sqlippool + detail

the user has this radreply records

Framed-IP-Address := 1.2.3.4
Framed-IPv6-Prefix := 2001:d0c6:0:2::/64
Delegated-IPv6-Prefix := 2001:d0c6:2::/48

(see log portions below) attributes are correctly sent to the NAS

in the queries (original from the distro package) %{Framed-IP-Address} and %{Framed-IPv6-Address} are correctly expanded to their own values %{Delegated-IPv6-Prefix} seems empty (but it's not ... it was just sent to the requester!)

the same happens for the "detail" log /etc/freeradius/3.0/sites-enabled/testsite Framed-IP-Address and Framed-IPv6-Address are correct Delegated-IPv6-Prefix is missing

Log output from the FreeRADIUS daemon

portions of freeradius -X

this seems correct

Sent Access-Accept Id 180 from 192.168.101.11:1812 to 192.168.101.4:34053 length 188
User-Name := "guest"
Service-Type = Framed-User
Acct-Interim-Interval = 1800
Idle-Timeout = 600
Session-Timeout = 604800
Framed-Protocol = PPP
Framed-Compression = Van-Jacobson-TCP-IP
Framed-IP-Address = 1.2.3.4
Framed-IP-Netmask = 255.255.255.255
Framed-IPv6-Prefix = 2001:d0c6:0:2::/64
Delegated-IPv6-Prefix = 2001:d0c6:2::/48
Mikrotik-Rate-Limit = "200M/200M"
DNS-Server-IPv6-Address = 2001:b020:0:404::50
DNS-Server-IPv6-Address = 2001:b020:0:404::51
MS-Primary-DNS-Server = 3.4.5.6
MS-Secondary-DNS-Server = 3.4.5.7

...

 # Executing section accounting from file /etc/freeradius/3.0/sites-enabled/testsite
 accounting {
 detail: EXPAND /var/log/freeradius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d
 detail: --> /var/log/freeradius/radacct/192.168.101.4/detail-20240124
 detail: /var/log/freeradius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d expands to /var/log/freeradius/radacct/192.168.101.4/detail-20240124
 detail: EXPAND %t
 detail: --> Wed Jan 24 17:15:20 2024
 [detail] = ok
 [unix] = ok
 sqlippool: EXPAND %{User-Name}
 sqlippool: --> test
 sqlippool: SQL-User-Name set to 'test'
 sqlippool: EXPAND UPDATE radippool SET expiry_time = NOW() + INTERVAL 604800 SECOND WHERE nasipaddress = '%{NAS-IP-Address}' AND pool_key = '%{NAS-Port}' AND username = '%{User-Name}' AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'
 sqlippool: --> UPDATE radippool SET expiry_time = NOW() + INTERVAL 604800 SECOND WHERE nasipaddress = '192.168.101.4' AND pool_key = '15728757' AND username = 'test' AND callingstationid = '24:5A:4C:AA:DD:69' AND framedipaddress = '1.2.3.4'
 sqlippool: Executing query: UPDATE radippool SET expiry_time = NOW() + INTERVAL 604800 SECOND WHERE nasipaddress = '192.168.101.4' AND pool_key = '15728757' AND username = 'test' AND callingstationid = '24:5A:4C:AA:DD:69' AND framedipaddress = '1.2.3.4'
 [sqlippool] = ok
 sql: EXPAND %{tolower:type.%{%{Acct-Status-Type}:-%{Request-Processing-Stage}}.query}
 sql: --> type.start.query
 sql: Using query template 'query'
 sql: EXPAND %{User-Name}
 sql: --> test
 sql: SQL-User-Name set to 'test'
 sql: EXPAND INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress, framedipv6address, framedipv6prefix, framedinterfaceid, delegatedipv6prefix ) VALUES ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{%{NAS-Port-ID}:-%{NAS-Port}}', '%{NAS-Port-Type}', FROM_UNIXTIME(%{%{integer:Event-Timestamp}:-%l}), FROM_UNIXTIME(%{%{integer:Event-Timestamp}:-%l}), NULL, '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Framed-IPv6-Address}', '%{Framed-IPv6-Prefix}', '%{Framed-Interface-Id}', '%{Delegated-IPv6-Prefix}' )
 sql: --> INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress, framedipv6address, framedipv6prefix, framedinterfaceid, delegatedipv6prefix ) VALUES ('81c00075', '908b07f2b5214a42a310cc2e42b0b475', 'test', '', '192.168.101.4', 'vlan110', 'Ethernet', FROM_UNIXTIME(3056198), FROM_UNIXTIME(3056198), NULL, '0', 'RADIUS', '', '', '0','0', 'BRAS1', '24:5A:4C:AA:DD:69', '', 'Framed-User', 'PPP', '1.2.3.4', '', '2a0d:d0c6:0:2::/64', '', '' )
 sql: Executing query: INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress, framedipv6address, framedipv6prefix, framedinterfaceid, delegatedipv6prefix ) VALUES ('81c00075','908b07f2b5214a42a310cc2e42b0b475', 'test', '', '192.168.101.4', 'vlan110', 'Ethernet', FROM_UNIXTIME(3056198), FROM_UNIXTIME(3056198), NULL, '0', 'RADIUS', '', '', '0', '0', 'BRAS1', '24:5A:4C:AA:DD:69', '', 'Framed-User', 'PPP', '1.2.3.4', '', '2a0d:d0c6:0:2::/64', '', '' )
 sql: SQL query returned: success
 sql: 1 record(s) updated

Relevant log output from client utilities

/etc/freeradius/3.0/sites-enabled/testsite

Wed Jan 24 17:15:20 2024
        Service-Type = Framed-User
        Framed-Protocol = PPP
        NAS-Port = 15728757
        NAS-Port-Type = Ethernet
        User-Name = "test"
        Calling-Station-Id = "24:5A:4C:AA:DD:69"
        Called-Station-Id = "BRAS1"
        NAS-Port-Id = "vlan110"
        Acct-Session-Id = "81c00075"
        Framed-IP-Address = 1.2.3.4
        Acct-Authentic = RADIUS
        Event-Timestamp = "Jan 24 2024 17:14:38 CET"
        Framed-IPv6-Prefix = 2001:d0c6:0:2::/64
        Acct-Status-Type = Start
        NAS-Identifier = "CCR2116-BRAS#1"
        Acct-Delay-Time = 0
        NAS-IP-Address = 192.168.101.4
        Acct-Unique-Session-Id = "908b07f2b5214a42a310cc2e42b0b475"
        Timestamp = 1706112920

Wed Jan 24 17:45:23 2024
        Service-Type = Framed-User
        Framed-Protocol = PPP
        NAS-Port = 15728757
        NAS-Port-Type = Ethernet
        User-Name = "test"
        Calling-Station-Id = "24:5A:4C:AA:DD:69"
        Called-Station-Id = "BRAS1"
        NAS-Port-Id = "vlan110"
        Acct-Session-Id = "81c00075"
        Framed-IP-Address = 1.2.3.4
        Acct-Authentic = RADIUS
        Event-Timestamp = "Jan 24 2024 17:44:38 CET"
        Framed-IPv6-Prefix = 2001:d0c6:0:2::/64
        Acct-Session-Time = 1800
        Idle-Timeout = 600
        Session-Timeout = 604800
        X-Ascend-Data-Rate = 2000000
        Ascend-Xmit-Rate = 2000000
        Mikrotik-Rate-Limit = "2M/2M"
        Acct-Input-Octets = 13095
        Acct-Input-Gigawords = 0
        Acct-Input-Packets = 302
        Acct-Output-Octets = 13918
        Acct-Output-Gigawords = 0
        Acct-Output-Packets = 250
        Acct-Status-Type = Interim-Update
        NAS-Identifier = "CCR2116-BRAS#1"
        Acct-Delay-Time = 3
        NAS-IP-Address = 192.168.101.4
        Acct-Unique-Session-Id = "908b07f2b5214a42a310cc2e42b0b475"
        Timestamp = 1706114723

Backtrace from LLDB or GDB

No response

alandekok commented 9 months ago

Questions belong on the freeradius-users mailing list.

As a small hint, reading the debug output helps. Delegated-IPv6-Prefix is in the Access-Accept, but not in the Accounting-Request.