Unlang policy to remove duplicate attributes from reply?
tach yon
tachyon at live.co.uk
Wed Jun 25 09:22:35 UTC 2025
Hello,
I've spent many hours searching the docs, examples, list posts, etc, plus AI generators - testing as many permutations I can think of - trying to find the correct syntax and method to do this with Unlang, but nothing seems to work 🙁
I'll try to explain in sudo-code what I mean:
if (number of Framed-IP-Address attributes > 1) {
update control {
# Save the first Framed-IP-Address to a temporary String (because I read ipaddr type isn't available).
&Tmp-String-0 := &reply:Framed-IP-Address[0]
}
update reply {
# Remove all Framed-IP-Address entries currently in the reply.
&Framed-IP-Address !* ANY
# Re-create Framed-IP-Address with the first value we saved temporarily.
# Cast as ipaddr because Framed-IP-Address needs that data type.
&Framed-IP-Address := (ipaddr) &control:Tmp-String-0
}
}
Everything I've tried is either invalid syntax, or a comma is expected after the cast statement, or freeradius cannot resolve to IP address, or it just doesn't work. It's starting to drive me crazy 🙁
If anyone could please help me understand what I'm doing wrong, it would be very much appreciated. Thank you in advance for your time and consideration!
More information about the Freeradius-Users
mailing list