Unlang policy to remove duplicate attributes from reply?

tach yon <[email protected]>
Newsgroups gmane.comp.freeradius.user
Message-ID <PA4PR03MB69749F7900AC5FFE35BACC30987BA@PA4PR03MB6974.eurprd03.prod.outlook.com>
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!
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.