Reverse string concatenation for multiple attributes

Franks Andy (IT Technical Architecture Manager) Andy.Franks at sath.nhs.uk
Thu Dec 10 20:54:37 CET 2015


That's pretty amazing really. One day I'll task myself with looking completely at the source code, but it would likely melt my brain.
The reason, behind the scenes, was we're trying to dynamically update the mac address limit on hp switch ports, but due to these horrible mitel phones with switches in the back, you've no idea whether the mac-limit 2 device (phone) comes up first, or what's plugged into it (pc), usually the pc, which means you need to do a disconnect or CoA to get the phone to present and then push the correct mac limit. Also, the mac address doesn't drop off the switch port when it disconnects from the phone, so you connect a different pc or laptop on the phone and then you have to log off the non-phone mac. All depends on accounting and lots of sql afaics.
Or we could just statically map the limit on the switch, but that's no challenge at all.
It's a shame you can't do mac-limit on multiple macs, with the newest counting, but HP don't work like that.
Thanks Arran!
Andy
________________________________________
From: Freeradius-Users [freeradius-users-bounces+andy.franks=sath.nhs.uk at lists.freeradius.org] on behalf of Arran Cudbard-Bell [a.cudbardb at freeradius.org]
Sent: 10 December 2015 19:27
To: FreeRadius users mailing list
Subject: Re: Reverse string concatenation for multiple attributes

>  .. It seems to indicate predefinition in a module, which is ok but your example looks more inline. I am guessing the sql bit matches the module instance name here and the query is loaded in a variable?

Or an xlat.  It's a polymorphic template type meaning it can be an attribute reference as you have below, an xlat expansion like "SELECT * FROM BLAH WHERE user = %{user-Name}", an exec `echo 'SELECT * FROM BLAH'`, or just a plain literal like 'SELECT * FROM BLAH WHERE 1'

> Would an xlat type section be therefore
>
> Map sql_instname &var {
>                Control:Tmp-string-0 += myfieldname
> }
>
> Or am i way out and it needs module definition?

Nope that's good.

Then

update request {
        Tmp-String-0 := "%{pairs:&control:Tmp-String-0[*]}"
}

To recombine into a list of comma delimited value pairs.

-Arran

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2




More information about the Freeradius-Users mailing list