(RADIATOR) Patch

Jerome Fleury jeje at jeje.org
Wed Jul 31 07:43:57 CDT 2002


Hello there,

I provide here a small patch, with hope that it will be integrated into 
next release.
This patch adds a special character ('%I' but feel free to use another 
one), that gives the nas identifier as an integer string instead of dotted 
decimal character string.
We use this on our heavily loaded platform to speed up SQL requests 
(they're A LOT faster if they're integer based instead of string based)


*** Util.pm     Sat Jul 27 04:01:03 2002
--- Radius/Util.pm    Wed Jul 31 10:11:06 2002
***************
*** 64,67 ****
--- 64,70 ----
       'z', sub { return unless $cpacket; 
MD5->hexhash($cpacket->getAttrByNum($Radius::Radius::USER_NAME))},

+      # This returns the NasIdentifier formatted as an string whose value 
is an integer like inet_aton
+      'I', sub { return unless $cpacket; my $ip = 0; map ($ip = 
$ip*256+$_, split('\.', $cpacket->getNasId() )); sprintf ('%u', $ip); },
+
       # From current time
       'd', sub { @time = localtime(time) unless @time; sprintf("%02d", 
$time[3]) },
***************
*** 324,328 ****
      # in one go, else may get unpleasant interactions, especially when the
      # the resulting string contains a %
!     $s =~ s/%([%abcCdDefghHijklLmMNopqQnPrRsStTUuvVyYz]|\d+)/{my $a = $1; 
$a =~ m@^\d@ ? $extras[$a] : &{$conversions{$a}}()}/egs;

      $s =~ s/%\{GlobalVar:([^{]+)\}/{&main::getVariable($1)}/egs;
--- 327,331 ----
      # in one go, else may get unpleasant interactions, especially when the
      # the resulting string contains a %
!     $s =~ s/%([%abcCdDefghHiIjklLmMNopqQnPrRsStTUuvVyYz]|\d+)/{my $a = 
$1; $a =~ m@^\d@ ? $extras[$a] : &{$conversions{$a}}()}/egs;

      $s =~ s/%\{GlobalVar:([^{]+)\}/{&main::getVariable($1)}/egs;


--
Jerome Fleury
===
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