Decoding Alcatel Accounting packets

Peter Lambrechtsen peter at crypt.nz
Sun Jul 24 09:49:47 CEST 2016


Following on from this thread:
http://lists.freeradius.org/pipermail/freeradius-users/2014-March/070930.html

I'm looking to do some further extension to some perl code I have to deal
with the TiMos / SROS Alcatel / Nokia 7750 Accounting packets. I'm
wondering if there is a smarter way of doing it than using perl.

I have 3 different accounting payloads I need to deal with.

A
        Alc-Acct-O-Inprof-Octets-64 = 0x0001000000000310593e
        Alc-Acct-O-Outprof-Octets-64 = 0x000100000000032ee6d4
        Alc-Acct-O-Inprof-Pkts-64 = 0x000100000000000106c2
        Alc-Acct-O-Outprof-Pkts-64 = 0x00010000000000011305
        Alc-Acct-I-statmode = "0x8001 minimal"
        Alc-Acct-I-All-Octets_64 = 0x800100000000061eecce
        Alc-Acct-I-All-Packets_64 = 0x8001000000000001a632
        Alc-Acct-I-statmode = "0x8002 minimal"
        Alc-Acct-I-All-Octets_64 = 0x80020000000000000c80
        Alc-Acct-I-All-Packets_64 = 0x80020000000000000020

For this I need to add the inprof and outprof Outbound packets
O-Inprof-Octets-64 = 0x0001000000000310593e = 51403070
O-Outprof-Octets-64 = 0x000100000000032ee6d4 = 53405396
51403070 + 53405396 =
Outbound = 104808466

Inbound
I-All-Octets_64 = 0x800100000000061eecce = 102689998
I-All-Octets_64 = 0x80020000000000000c80 = 3200
102689998 + 3200 =
Inbound = 102693198

The issue with the above is the Alc-Acct-I-All-Octets_64 is in there twice
so I need to create an array and loop through it to see what type it is.

B
        Alc-Acct-I-Inprof-Octets-64 = 0x00010000000000000000
        Alc-Acct-I-Outprof-Octets-64 = 0x00010000000000000000
        Alc-Acct-I-Inprof-Pkts-64 = 0x00010000000000000000
        Alc-Acct-I-Outprof-Pkts-64 = 0x00010000000000000000
        Alc-Acct-I-Inprof-Octets-64 = 0x0002000000000000abb4
        Alc-Acct-I-Outprof-Octets-64 = 0x00020000000000000000
        Alc-Acct-I-Inprof-Pkts-64 = 0x000200000000000001ba
        Alc-Acct-I-Outprof-Pkts-64 = 0x00020000000000000000
        Alc-Acct-O-Inprof-Octets-64 = 0x00010000000000000000
        Alc-Acct-O-Outprof-Octets-64 = 0x0001000000000001f372
        Alc-Acct-O-Inprof-Pkts-64 = 0x00010000000000000000
        Alc-Acct-O-Outprof-Pkts-64 = 0x0001000000000000027f

B is similar to A as the outbound logic is the same and the inbound logic I
need to loop through I-Inprof-Octets-64 and I-Outprof-Octets-64 and add
them all up as Inbound packets.

C
        Alc-Acct-I-Inprof-Octets-64 = 0x500a0000000000000000
        Alc-Acct-I-Inprof-Pkts-64 = 0x500a0000000000000000
        Alc-Acct-O-Inprof-Octets-64 = 0x500a0000000000000000
        Alc-Acct-O-Inprof-Pkts-64 = 0x500a0000000000000000
        Alc-Acct-I-Inprof-Octets-64 = 0x50140000000000000000
        Alc-Acct-I-Inprof-Pkts-64 = 0x50140000000000000000
        Alc-Acct-O-Inprof-Octets-64 = 0x50140000000000019e94
        Alc-Acct-O-Inprof-Pkts-64 = 0x5014000000000000027f
        Alc-Acct-I-Inprof-Octets-64 = 0x501e0000000000000000
        Alc-Acct-I-Inprof-Pkts-64 = 0x501e0000000000000000
        Alc-Acct-O-Inprof-Octets-64 = 0x501e0000000000000000
        Alc-Acct-O-Inprof-Pkts-64 = 0x501e0000000000000000

This is using a different card so need to break it out as first byte as
text, the second byte converted to dec, then the rest of the value
converted into dec:

Inbound
        Alc-Acct-I-Inprof-Octets-64 = 0x500a0000000000000000 - "50 - 10 - 0"
        Alc-Acct-I-Inprof-Octets-64 = 0x50140000000000000000 - "50 - 20 - 0"
        Alc-Acct-I-Inprof-Octets-64 = 0x501e0000000000000000 - "50 - 30 - 0"

Outbound
        Alc-Acct-O-Inprof-Octets-64 = 0x500a0000000000000000 - "50 - 10 - 0"
        Alc-Acct-O-Inprof-Octets-64 = 0x50140000000000019e94 - "50 - 20 -
106132"
        Alc-Acct-O-Inprof-Octets-64 = 0x501e0000000000000000 - "50 - 30 -
0"

Any ideas how to easily convert these, or do I just stick with Perl?

Cheers

Peter


More information about the Freeradius-Users mailing list