(RADIATOR) Interesting Request

miko at yournetplus.com miko at yournetplus.com
Mon Aug 22 12:02:32 CDT 2005


Thanks Mike,,, I was able to use the {RecvSocket} reference.

Here is an example of the code I came up with in testing, using a 
PreProcessingHook to displa the info in a log. The only stipulation on 
this working tho is that you must use BindAddress and force radiator to 
bind on the IPs of the machine, allowing it to bind to 0.0.0.0 ends up 
returning a null for the localipaddress for some reason...

PreProcessingHook sub {                                      \
  my $p = ${$_[0]};                                           \
  my $insockaddr = getsockname($p->{RecvSocket});             \ 

  my ($inport,$inaddr) = Radius::Util::unpack_sockaddr_in($insockaddr); \
  $inaddr = Radius::Util::inet_ntop($inaddr); 
                              \
  &main::log($main::LOG_DEBUG, "LocalAddr: $inaddr,$inport");              \
}


-Miko

<----- Original Message ----->
From: Mike McCauley <mikem at open.com.au>
To: "miko at yournetplus.com" <miko at yournetplus.com>
CC: radiator at open.com.au
Sent: Friday, August 19, 2005 4:29:13 PM
Subject: (RADIATOR) Interesting Request
> Hello Miko,
> 
> On Saturday 20 August 2005 04:09, miko at yournetplus.com wrote:
> 
>>Does anyone on the list know if there is a way to reference in a hook
>>what IP Address a radius request was sent to on a multihomed system???
> 
> 
> Hmm, it would be a bit tricky.
> Each received request has a reference to the socket it was received on saved 
> in $p->{RecvSocket}. You might be able to get the information you need with a 
> getsockopt(). 
> Also, all the current Radius sockets are stored in a hash like so 
> $main::radius_sockets{$bind_address}{$port}
> 
> so by doing a search in that hash for the socket you may be able to find the 
> bind address and port of the socket that received the request.
> 
> Hope that helps.
> 
> Cheers.
> 
> 
>>Basically I have my radiator process tied to multiple IP addresses on my
>>server and I would like to parse the requests based on what IP Address
>>my NASes sent the request to...
>>
>>Thanks in advance,
>>-Miko
>>
>>--
>>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.
> 
> 

--
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