Dictionary question

Nathan Ward lists+freeradius at daork.net
Mon Feb 27 10:26:24 UTC 2023


> On 27/02/2023, at 11:12 PM, Igor Smitran <sigor at blic.net> wrote:
> 
> 
> On 26.2.23. 23:40, Matthew Newton via Freeradius-Users wrote:
>> 
>> No. The preprocess module can parse Cisco-AVpair and split it up into separate attributes, if they have been defined in the local dictionary with the same name (see the preprocess config for the setting).
>> 
>> But there's nothing to go the other way and create it, you'll need to define local attributes and then concatenate them all yourself. Should be simple enough with a bit of unlang (and a policy to keep things tidy, if you've got more than one or two to do).
>> 
> I was hoping that there is a way to prepend/append some string to a value.
> 
> I am trying to find a way to have more than one NAS at the same time.
> 
> cisco ASR 9K:
> 
> Cisco-AVPair    | += | subscriber:sub-qos-policy-out=50Mbps
> 
> Juniper ERX:
> 
> ERX-Egress-Policy-Name  | =  | 50Mbps
> 
> cisco ASR 1K:
> 
> Cisco-Policy-Down       | =  | 50Mbps
> 
> 
> In case that we have same values and different attributes it would be lot easier to map attributes and based on NAS-IP send appropriate response. It would be even possible to use dictionary aliases without any changes in the database fields/values.
> 
> At the same time it would be a lot easier to create new services from CRM.

You can map based on an attribute you define on the client definition, which is a bit easier.

clients.conf:

client foo {
  ipaddr = 1.2.3.4
  flavour = mx
}


policy:

if ("%{client:flavour}" == 'mx’) {
  .. blah ..
}


I then have a policy called “set_mx_auth_attributes” which does mx specific stuff.

“Flavour” is something I made up, you might call it something else, like “bng_type” or “flavor” if your country does not spell correctly.

I have custom attributes for things like plan speed, like "Private-Speed-Down” or similar in the user database, which gets translated in to the BNG specific attribute in set_xx_auth_attributes, and then deleted.
Have a look at the end of the raddb/dictionary for how to define these.


PS - this is off topic for this list, but you might find it is better to use ERX-CoS-Parameter-Type := “T02 50m” if you are doing a BNG application.
This uses the class-of-service shapers, rather than having a policer defined for each speed you might want to offer.
You can do similar things in ASR9k and ASR1k, but I’ve long forgotten the attributes.

--
Nathan Ward



More information about the Freeradius-Users mailing list