Using unlang for Calling-Station-Id

Kanwar Ranbir Sandhu m3freak at thesandhufamily.ca
Sun Sep 13 16:37:52 CEST 2009


On Sat, 2009-09-12 at 23:28 +0100, Alexander Clouter wrote:
> In my system, I use the following to RFCese the incoming 
> Calling-Station-ID:
> ----
> if ( "%{request:Calling-Station-Id}" =~ /^([0-9a-f]{2}).?([0-9a-f]{2}).?([0-9a-f]{2}).?([0-9a-f]{2}).?([0-9a-f]{2}).?([0-9a-f]{2})$/i ) {
> 	update request {
> 		Calling-Station-Id := "%{1}-%{2}-%{3}-%{4}-%{5}-%{6}"
> 	}
> }
> ----
>  
> In your situation you just probably need to remove the '^' and '$' from 
> the regex.  

I'll try that out, but I'm not worried about the current MAC format.  I
just wanted to dump everything else (in Calling-Station-Id) and only
store the MAC.

> If you also make this a policy, then you can make your 
> configuration simpler.

I'm not sure what you mean here.  Please explain.
 
> As this is just for logging, you probably just want the amendment in 
> post-auth only, just before you call 'sql' or whatever.  

So, I don't need it in preacct?  I mean, it's working as is.  Would it
be better to put in post-auth versus preacct?

> However as you 
> have not really said *what* is is you are hoping to get out of all of 
> this, I have no suggestions to make.

We're using Nas-Port for pool-key in sqlippool.conf.  We want to try out
Calling-Station-Id.  But, before we try that, we wanted the
Calling-Station-Id attribute received from the NAS to be trimmed to only
include the MAC.  The NAS sends a whole bunch of other text plus the
MAC, which ends up being over 100 characters long.  Shortening the
attribute to just the MAC itself will allow us to keep the field length
in the table the same.

FYI: we want to try Calling-Station-Id as a pool-key because we're not
100% sure if the NAS is sending unique NAS-Port attributes.  The vendor
can't confirm this either (yes, that's insane).

Regards,

Ranbir

-- 
Kanwar Ranbir Sandhu
Linux 2.6.27.30-170.2.82.fc10.x86_64 x86_64 GNU/Linux 
10:23:23 up 8 min, 2 users, load average: 0.45, 0.30, 0.15 





More information about the Freeradius-Users mailing list