[RADIATOR] Defining share secret per NASID instead of IP

Bengi Sağlam bengi at socialandbeyond.com
Tue Nov 4 04:54:09 CST 2014


Hi Heikki,

Thanks for the solution, PreClientHook has solved my issue. In the
beginning I wrote this hook:

PreClientHook  sub {  \
        my $nasId = ${$_[0]}->get_attr('NAS-Identifier'); \
${$_[0]}->add_attr('Called-Station-Id',$nasId);  \
}

With this PreClientHook I was able to see  Accounting packet with the
status of Accounting-On on the radiator log by fetching the secret with the
MAC. However, I realised that this hook adds 'Called-Station-Id' per each
packet and this caused to have multiple 'Called-Station-Id' attribute for
the other packets as it is seen below on the log:

*Code:       Accounting-Request*
*Identifier: 14*
*Authentic:  <169><21>r<241>2<232>@<227>Eu<5><|<140><186><159>*
*Attributes:*
* Acct-Status-Type = Stop*
* Acct-Terminate-Cause = Admin-Reset*
* NAS-Port-Type = Wireless-IEEE-802-11*
* Calling-Station-Id = "04:46:65:66:D6:0D"*
* Called-Station-Id = "00-0C-42-FA-53-30"*
* NAS-Port-Id = "bridgeLAN"*
* User-Name = "04_46_65_66_D6_0D at Connect_Directly"*
* NAS-Port = 2150629382*
* Acct-Session-Id = "80300006"*
* Framed-IP-Address = 10.5.0.18*
* Mikrotik-Host-IP = 10.5.0.18*
* Event-Timestamp = 1415033836*
* Acct-Input-Octets = 10127*
* Acct-Output-Octets = 12976*
* Acct-Input-Gigawords = 0*
* Acct-Output-Gigawords = 0*
* Acct-Input-Packets = 58*
* Acct-Output-Packets = 46*
* Acct-Session-Time = 293*
* NAS-Identifier = "00-0C-42-FA-53-30"*
* Acct-Delay-Time = 0*
* NAS-IP-Address = 217.124.187.43*
* Called-Station-Id = "00-0C-42-FA-53-30"*

To solve having multiple attribute problem, I made a small if with the perl
in the PreClientHook by checking the 'Called-Station-Id' attribute, so the
attribute is not added when it exists already. Following PreClientHook
could be a solution for the ones who might have the same problem like me.


PreClientHook  sub {  \
          my $nasId = ${$_[0]}->get_attr('NAS-Identifier'); \
my $stationId = ${$_[0]}->get_attr('Called-Station-Id'); \
${$_[0]}->add_attr('Called-Station-Id',$nasId) unless($stationId); \
}

Thanks,
Bengi.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open.com.au/pipermail/radiator/attachments/20141104/8d67a270/attachment-0001.html 


More information about the radiator mailing list