Hello there,

I provide here a small (but useful) patch. This one allows to use the Event-Timestamp accounting attribute sent by some NAS (especially Cisco ones in later releases) instead of having to calculate it. (=recvtime - acct_delay)
This patch performs a small check: if the calculated timestamp and the NAS timestamp differ for more than 300s (this is arbitrary), then we assume that the server and the NAS are not synchronized, so it fallbacks to the calculated timestamp (default).

Why did we use this ? Because the timestamp sent by the NAS looks much more reliable than the calculated one. As of a consequence, it performs better in duplicate finding.

This code should probably be cleaned, maybe "config-variabled", but I hope it will be integrated in futures releases.

--
Jerome Fleury Tiscali/LibertySurf/WC
Network Engineer Tel/Fax: +33 1 45082314


--------------------------------------------
*** Handler.pm.bak Mon Oct 21 12:34:37 2002
--- Handler.pm Wed Oct 23 12:46:20 2002
***************
*** 204,214 ****
{
# Add a pseudo attribute for the Timestamp
# (adjusted by Delay-Time)
# Some modules (AuthSQL) and logfile scripts rely on it
! $p->add_attr('Timestamp',
! $p->{RecvTime}
! - int $p->getAttrByNum($Radius::Radius::ACCT_DELAY_TIME));

# Log the packet
my $status_type = $p->getAttrByNum
($Radius::Radius::ACCT_STATUS_TYPE);
--- 204,231 ----
{
# Add a pseudo attribute for the Timestamp
# (adjusted by Delay-Time)
# Some modules (AuthSQL) and logfile scripts rely on it
! # patch by Jerome Fleury <[EMAIL PROTECTED]>:
! # rely on Event_Timestamp attribute if present
! my $timestamp;
! $timestamp = $p->{RecvTime} - int $p->getAttrByNum($Radius::Radius::ACCT_DELAY_TIME);
! # this patch uses Event-Timestamp if it exists
! if (defined $p->getAttrByNum($Radius::Radius::ACCT_EVENT_TIMESTAMP)) {
! # we use arbitrary 300s of clock difference to check attribute reliability
! if (abs($timestamp - $p->getAttrByNum($Radius::Radius::ACCT_EVENT_TIMESTAMP) > 300)) {
! # NAS clock is not synchronized with the server, let's use server timestamp, log a warning
! $self->log($main::LOG_WARNING, "$nas_id clock not synchronized with server!");
! $p->add_attr('Timestamp', $timestamp);
! }
! else {
! # Event_Timestamp looks correct, let's use it
! $p->add_attr('Timestamp', $p->getAttrByNum($Radius::Radius::ACCT_EVENT_TIMESTAMP));
! }
! }
! # we don't have Event_Timestamp attribute
! else { $p->add_attr('Timestamp', $timestamp); }
!

# Log the packet
my $status_type = $p->getAttrByNum
($Radius::Radius::ACCT_STATUS_TYPE);


-------------------------------------------------------
*** Radius.pm.bak Mon Oct 21 12:33:55 2002
--- Radius.pm Mon Oct 21 12:34:25 2002
***************
*** 114,117 ****
--- 114,118 ----
$Radius::Radius::ACCT_OUTPUT_PACKETS = 48;
$Radius::Radius::ACCT_TERMINATE_CAUSE = 49;
+ $Radius::Radius::ACCT_EVENT_TIMESTAMP = 55;
$Radius::Radius::CHAP_CHALLENGE = 60;
$Radius::Radius::NAS_PORT_TYPE = 61;




--
Jerome Fleury
===
Archive at http://www.open.com.au/archives/radiator/
Announcements on [EMAIL PROTECTED]
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to