Guess I should have persevered for another 10 minutes. I have found a solution to my problem, which is to change my accounting_*_query from: [...] '%{NAS-Port-Type}', [...] to: [...] '%{sql:SELECT shortname FROM ${nas_table} WHERE nasname = %{NAS-Port-Type}}', \ [...] However, I'm still curious if it's possible to configure the behaviour of FreeRADIUS in this regard? Jack. On 17 August 2011 09:56, Jack Patmos <jack.patmos@googlemail.com> wrote:
I am running FreeRADIUS 2.1.7.
I am attempting to write accounting data to Postgres database. In the database the NAS port type from the request is stored as the integer value that defines the port type in RFC2865 (e.g., 19 - 'Wireless - IEEE 802.11'). The database table is fixed and cannot be changed.
When I send a test packet from radclient that contains a port type:
Called-Station-Id = "xx-xx-xx-xx-xx-xx" User-Name = "REALM/user" Framed-IP-Address = xxx.xxx.xxx.xxx NAS-IP-Address = xxx.xxx.xxx.xxx NAS-Port-Type = 19 [...]
Then when it is received by the server the port type has always been translated into its string value:
rad_recv: Accounting-Request packet from host 127.0.0.1 port 54361, id=245, length=262 Called-Station-Id = "xx-xx-xx-xx-xx-xx" User-Name = "REALM/user" Framed-IP-Address = xxx.xxx.xxx.xxx NAS-IP-Address = xxx.xxx.xxx.xxx NAS-Port-Type = Wireless-802.11 Acct-Status-Type = Start [....] +- entering group preacct {...} ++[preprocess] returns ok
Obviously, I can't insert 'Wireless-802.11' into an integer field in the database. Is there away of disabling this lookup so that FreeRADIUS does not translate these values when it receives a packet, or am I going to have to code my own reverse lookup into my accounting module?
I also have the same problem for other fields like Acct-Termination-Cause.
Jack.