[RADIATOR] Framed-Route maniuplation
Ian Mordey
ian.mordey at griffin.com
Wed Oct 27 03:08:26 CDT 2010
Cheers Hugh
That works great.
Thanks again
-----Original Message-----
From: Hugh Irvine [mailto:hugh at open.com.au]
Sent: 27 October 2010 08:59
To: Ian Mordey
Cc: radiator at open.com.au
Subject: Re: [RADIATOR] Framed-Route maniuplation
Hello Ian -
The PostProcessingHook is not called with $result, so using it will not
work.
Try something more like this:
sub
{
my $p = ${$_[0]};
my $rp = ${$_[1]};
my $profile = $rp->get_attr('Framed-Route');
my $ip = $rp->get_attr('Framed-IP-Address');
return unless defined $profile && defined $ip;
my $framedroute = "$profile $ip";
&main::log($main::LOG_DEBUG, "Framed-Route = $framedroute");
$rp->change_attr('Framed-Route', $framedroute);
return;
}
Put the above in a file called for example "framed_route.pl" in your
DbDir directory, and call it from your configuration file as follows:
<Handler .....>
.....
PostProcessingHook file:"%D/framed_route.pl"
</Handler>
I haven't tested the above, but you should get the idea.
regards
Hugh
On 27 Oct 2010, at 18:32, Ian Mordey wrote:
> Ok. Please excuse my awful perl skills.. I've used an example from
> hooks.txt mainly your replaceProfiles code. Can someone please point
> me in the direction of where I'm going wrong?
>
> Thanks
>
> PostProcessingHook sub
> {
> my $p = ${$_[0]};
> my $rp = ${$_[1]};
> my $result = ${$_[2]};
> my $profile;
> my $ip;
>
> if (($result == $main::ACCEPT) &&
> ($profile = $rp->get_attr('Framed-Route')) &&
> ($ip = $rp->get_attr('Framed-IP-Address')) )
> { \
> &main::log($main::LOG_DEBUG,
> "Framed-Route = $profile $ip");
> $rp->delete_attr('Framed-Route');
> $rp->parse(&main::getVariable($profile));
> }
> return;
> }
>
>
>
> -----Original Message-----
> From: Hugh Irvine [mailto:hugh at open.com.au]
> Sent: 26 October 2010 15:42
> To: Ian Mordey
> Cc: radiator at open.com.au
> Subject: Re: [RADIATOR] Framed-Route maniuplation
>
>
> Hello Ian -
>
> You will need to use something like a PostProcessingHook to deal with
> the reply attributes in the reply packet.
>
> There are numerous examples of various hooks in the file
> "goodies/hooks.txt".
>
> regards
>
> Hugh
>
>
> On 27 Oct 2010, at 00:05, Ian Mordey wrote:
>
>> Hi there
>> I'm trying to replicate a response from one radiator server to
>> another
> with a different SQL backend and schema. I'm struggling to get the
> Framed-Route attribute formatted properly.
>>
>> Our client expects a framed route including the gateway like this:
>> Framed-Route = "1.2.3.4/29 1.2.3.5"
>>
>> The new server sends a framed route
>> Framed-Route = "1.2.3.4/29"
>>
>> So I need to rewrite the Framed-Route with "1.2.3.4/29" followed by
> the Framed-IP-Address. This is also conditional because the
> Framed-Route in the reply attributes doesn't always exist.
>>
>> The problem I'm struggling with is that the reply attributes on the
> SQL backend are all in one column ReplyAttr for example:
>>
>> mysql> select ReplyAttr from UserProfiles where ReplyAttr like
>> mysql> '%Route%' limit 1;
>>
> +---------------------------------------------------------------------
> +--
> -------------------------------------------------+
>> | ReplyAttr
> |
>>
> +---------------------------------------------------------------------
> +--
> -------------------------------------------------+
>> | Service-Type = Framed-User, Framed-Protocol = PPP,
>> | Framed-IP-Address
>
>> | = 1.2.3.5, Framed-Route = 1.2.3.4/29 |
>>
>> How can I manipulate the Framed-Route attribute when it is all in the
> same column?
>>
>> Cheers
>> Ian
>> _______________________________________________
>> radiator mailing list
>> radiator at open.com.au
>> http://www.open.com.au/mailman/listinfo/radiator
>
>
>
> NB:
>
> Have you read the reference manual ("doc/ref.html")?
> Have you searched the mailing list archive
> (www.open.com.au/archives/radiator)?
> Have you had a quick look on Google (www.google.com)?
> Have you included a copy of your configuration file (no secrets),
> together with a trace 4 debug showing what is happening?
>
> --
> Radiator: the most portable, flexible and configurable RADIUS server
> anywhere. Available on *NIX, *BSD, Windows, MacOS X.
> Includes support for reliable RADIUS transport (RadSec), and DIAMETER
> translation agent.
> -
> Nets: internetwork inventory and management - graphical, extensible,
> flexible with hardware, software, platform and database independence.
>
>
>
>
NB:
Have you read the reference manual ("doc/ref.html")?
Have you searched the mailing list archive
(www.open.com.au/archives/radiator)?
Have you had a quick look on Google (www.google.com)?
Have you included a copy of your configuration file (no secrets),
together with a trace 4 debug showing what is happening?
--
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows, MacOS X.
Includes support for reliable RADIUS transport (RadSec), and DIAMETER
translation agent.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
More information about the radiator
mailing list