From: Alan T. DeKok Date: Sun, 11 May 2025 13:22:37 +0000 (-0400) Subject: the protocol encode xlat can't actually take a quoted string X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72cd54588a0b6bad2b37ddd73495146ff4ae11ad;p=thirdparty%2Ffreeradius-server.git the protocol encode xlat can't actually take a quoted string it has to take an attribute reference, because it manually parses the input as a tmpl_attr. We arguably need to update the xlat function arguments to indicate whether or not the argument expects to see a cursor. And if so, perhaps put a pointer to the cursor into a box of FR_TYPE_VOID. which then lets functions like this either take a cursor of things to encode, OR a string which is then parsed into a list of things to encode. --- diff --git a/doc/antora/modules/reference/pages/xlat/protocol.adoc b/doc/antora/modules/reference/pages/xlat/protocol.adoc index 8db56059171..7e18df04c73 100644 --- a/doc/antora/modules/reference/pages/xlat/protocol.adoc +++ b/doc/antora/modules/reference/pages/xlat/protocol.adoc @@ -69,15 +69,18 @@ It returns the raw encoded data [source,unlang] ---- -%dhcpv4.encode("Relay-Agent-Information.Circuit-Id = 0xabcdef, Relay-Agent-Information.Remote-Id = 0x010203040506") -%radius.encode("User-Name = 'ABCD'") -Tmp-Octets-1 := %dhcpv4.encode(request.Relay-Agent-Information.[*]) +octets data + +reply := { + User-Name = 'ABCD' +} + +data = %radius.encode(reply) ---- .Output ``` -0x520d0103abcdef0206010203040506 0x010641424344 ```