Parsing octets string via rlm_expr

Lotkov Svyatoslav ellezdi at gmail.com
Tue Dec 11 15:27:29 CET 2018


Hi everyone!


We are trying to parse byte-string from Nokia ALU device accounting.

AV-pairs looks like:



Alc-Acct-O-Inprof-Octets-64 = 0x00030000000000000001

Alc-Acct-O-Outprof-Octets-64 = 0x00030000000000003d9f

Alc-Acct-O-Inprof-Octets-64 = 0x000400000000000000b1

Alc-Acct-O-Outprof-Octets-64 = 0x000400000000000000e8

Alc-Acct-I-All-Octets_64 = 0x80030000000000000005

Alc-Acct-I-All-Octets_64 = 0x80040000000000000000



We need to obtain second byte from Alc-Acct-O-Inprof-Octets-64 (this byte
represents traffic-class number)

Also, we need last 8 bytes from the same pair (this counter represents
bytes counter itself)



Trying this:

%{expr: (0x80030000000000003d9f >> 64) & 0xFF}

Raises an error - Shift must be less than 63 (was 64)



This

EXPAND %{expr: ((0x00030000000000003d9f >> 62) >> 2) & 0xFF}

(0) --> 255



How can we obtain this counters without using an rlm_perl or rlm_python for
av-pair parsing?


More information about the Freeradius-Users mailing list