dynamic lookup of list entries

James Potter Jim.Potter at jisc.ac.uk
Fri Jan 26 13:47:45 UTC 2024


Hi all,

Here is the situation I'm trying to get working with FreeRadius, but having tried a load of variations around this I'm still stuck.

I have a list of sites with specific VLANs I'd like users to end up on:

sites {
                1 {
                                vlan = 234
                }
                2 {
                                vlan = 245
                }
}

I then have some clients, each with a site assigned:

client cli1 {
                ipaddr = 1.2.3.4
                secret = asdfasdf
                site = 1
}

I'd now like to assign the VLAN from sites, something like:

post-auth {
update reply {
                               Tunnel-Private-Group-ID = ${sites[${client.site}].vlan}
                }
}

But I've not a found a way of looking up an entry in a map dynamically

${sites.1.vlan}        works (gives 234)

${client.site}           works (gives 1)

But

${sites.${client.site}.vlan}      (or variations) doesn't work for me

Do you have a way of doing this? (Or a different approach? I've also tried embedding sites in clients by setting client{sites = ${sites.1} } - no banana either).
I'm trying to avoid death by switch statement here, one org I work with has 120 sites

Any help would be greatly appreciated

Thanks,

Jim Potter
UK



More information about the Freeradius-Users mailing list