AcctSessionTime missing in Interims-Update / calculated by FR

Alan DeKok aland at deployingradius.com
Tue Mar 27 15:30:25 CEST 2018


On Mar 26, 2018, at 10:08 PM, Michael Markstaller via Freeradius-Users <freeradius-users at lists.freeradius.org> wrote;
> thanks again for your help!

  It's what I do... I'm not *always* cranky.

> It got me times factor 1000 too high: so I fiddled around wrong with the
> formula and parenthesis wrong - my fault - sorry ;)

  Why was it 1000 times too high?  %l is seconds.  Acct-Start-Time is seconds.

> But as I have no Acct-Start-Time in the Interim-Update packet it still
> fails, how should FR know in preacct about Acct-Start-Time without
> looking at the database.

  It doesn't.  It has to look at the database.

> --- cut ---
> rad_recv: Accounting-Request packet from host 172.x.x.x port 45045,
> id=222, length=535
> 	User-Name = "W0xxxx"
> 	NAS-Port = 249856
> 	Service-Type = Framed-User
> 	Framed-Protocol = PPP
> 	Called-Station-Id = "1x.x.x.x"
> 	Calling-Station-Id = "2x.x.x.x"
> 	Acct-Status-Type = Start

  That's a bit easier to fix:

	if ((Acct-Status-Type == Start) && !Acct-Start-Time) {
		update request {
			Acct-Start-Time := "%l"
		}
	}

> rad_recv: Accounting-Request packet from host 172.x.x.x port 45045,
> id=223, length=565
> 	User-Name = "W0xxxx"
> 	NAS-Port = 249856
> 	Service-Type = Framed-User
> 	Framed-Protocol = PPP
> 	Framed-IP-Address = 172.y.x.x
> 	Called-Station-Id = "1x.x.x.x"
> 	Calling-Station-Id = "2x.x.x.x"
> 	Acct-Status-Type = Interim-Update

  And no Acct-Start-Time.  Lovely.

> gives me AcctSessionTime of 1522110184 in DB which is pretty clear as
> the substracted AcctStartTime is still 0/NULL in this context.
> So my AcctSessionTime is simply the timestamp of the last update.
> Good enough.

  Not really.  You should do:

	if ((Acct-Status-Type == Interim-Update) && Acct-Start-Time && !Acct-Session-Time) {
		update request {
			Acct-Session-Time := ...
		}
	}

> Good and persistent solution: No!
> 
> But still: it gave me an Idea how to get to a result in the reports
> anyway: just use the (wrong) AcctSessionTime from the SQL-DB - substract
> AcctStartTime from DB, easy, et voila ;-)
> Fix it in the display with wrong data in the backend: not neat but working.

  It's better to fix it in FR, and then write the correct information to the DB.

> P.S.: -> I'm fully aware that the source of the problem is the ASA not
> sending AcctSessionTime and AcctStartTime, not FR - but I'm too old and
> experienced to open a Bug at Cisco which is usually unfortunately
> totally useless..

  Yeah.  I've seen vendors who spend ~10M a year on Cisco get blown off for bug reports.

> Though, I think about opening a bug at Cisco: because the 1hrs minimum
> Interim-Update interval of the ASA is an absolute No-Go and ridiculous..
> Because the base for all of this is: I want to see the status of my
> clients/users in nearly realtime to be able to support them at best.

  Sure.

  Alan DeKok.




More information about the Freeradius-Users mailing list