(RADIATOR) Acct-Output-Octets and values larger than 4Gb

Mike McCauley mikem at open.com.au
Thu Feb 3 02:37:19 CST 2005


Hello Igor,

We will be happy to add this to the goodies. Its in the latest patch set now.

But FYI, there is a little typo there:
defined(my $inoctets = $p->get_attr('Accti-Input-Octets')))
should of course be
defined(my $inoctets = $p->get_attr('Acct-Input-Octets')))

Thanks for your contribution!

Cheers.

On Thursday 03 February 2005 17:33, Igor Briski wrote:
> On Thu, 2005-02-03 at 09:38 +1100, Brian Morris wrote:
> > Hi Folks,
> >
> > I am trying to record the number of bytes (or Mb) downloaded by our
> > broadband customers but Acct-Output-Octets loops back to zero once the
> > customer has downloaded more than 4Gb in a session (unsigned integer
> > limit).
> >
> > We also receive ERX attributes Unisphere-Output-Gigapackets and
> > Unisphere-Output-Gigawords but  these are defined as integer values so
> > I am assuming they only report the number of whole Gigs.
> >
> > So I am looking for a way of recording the number of Mb downloaded
> > with some accuracy better than whole Gb when the user has downloaded
> > more than 4Gb...
> >
> > I guess one method would be to calculate it based on a formula
> > something like TotalMb = (((gigawords div
> > 4)+acctoutputoctets)/1000000)
> > But is there a better way???
>
> This is a hook I wrote for our broadband service. It is using
> Acct-Input-Gigawords attribute which contains the number of times the
> Acct-Input-Octets has wrapped. I believe that the
> Unisphere-Output-Gigawords does the same, so just replace the attribute
> names in this hook.
>
> Maybe this could be added to goodies/ subdirectory in Radiator
> distribution?
>
>
> # -*- mode: Perl -*-
> #
> # 2004. Igor Briski, Iskon Internet d.d.
> #
> # Detects the presence of Acct-(Input|Output)-Gigawords
> # attribute and calculates the real Acct-(Input|Output)-Octets
> # values, and finally, replaces the values
>
> sub
> {
>   my $p = ${$_[0]};
>   my $code = $p->code();
>
>   if ($code eq 'Accounting-Request' &&
>       defined(my $ingiga = $p->get_attr('Acct-Input-Gigawords')) &&
>       defined(my $inoctets = $p->get_attr('Accti-Input-Octets')))
>       {
>         &main::log($main::LOG_DEBUG,
>         "Acct-Input-Gigawords attribute present,Counter overflowed.");
>
>          my $newinoctets = $inoctets + ($ingiga * 4294967296);
>          $p->change_attr('Acct-Input-Octets', $newinoctets);
>
>          &main::log($main::LOG_DEBUG,
>          "Acct-Input-Gigawords=$ingiga,Acct-Input-Octets =$inoctets");
>          &main::log($main::LOG_DEBUG,
>          "Calculated and replaced Acct-Input-Octets=$newinoctets");
>        }
>
>    if ($code eq 'Accounting-Request' &&
>        defined(my $outgiga = $p->get_attr('Acct-Output-Gigawords')) &&
>        defined(my $outoctets = $p->get_attr('Acct-Output-Octets')))
>        {
>          &main::log($main::LOG_DEBUG,
>          "Acct-Output-Gigawords attribute present,Counter overflowed.");
>
>          my $newoutoctets = $outoctets + ($outgiga * 4294967296);
>          $p->change_attr('Acct-Output-Octets', $newoutoctets);
>
>          &main::log($main::LOG_DEBUG,
>         "Acct-Output-Gigawords=$outgiga,Acct-Output-Octets=$outoctets");
>          &main::log($main::LOG_DEBUG,
>          "Calculated and replaced Acct-Output-Octets = $newoutoctets");
>         }
>         return;
> }

-- 
Mike McCauley                               mikem at open.com.au
Open System Consultants Pty. Ltd            Unix, Perl, Motif, C++, WWW
9 Bulbul Place Currumbin Waters QLD 4223 Australia   http://www.open.com.au
Phone +61 7 5598-7474                       Fax   +61 7 5598-7070

Radiator: the most portable, flexible and configurable RADIUS server 
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, 
Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS, 
TTLS, PEAP etc on Unix, Windows, MacOS etc.

--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list