From: Nick Porter Date: Wed, 19 May 2021 16:02:00 +0000 (+0100) Subject: Update documentation for %(unpack: ) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db1cbd719a23cc6b6a7eaad4b2a25386288dc8af;p=thirdparty%2Ffreeradius-server.git Update documentation for %(unpack: ) --- diff --git a/doc/antora/modules/raddb/pages/mods-available/unpack.adoc b/doc/antora/modules/raddb/pages/mods-available/unpack.adoc index d8ab5f1f6fa..5527d2a1d7b 100644 --- a/doc/antora/modules/raddb/pages/mods-available/unpack.adoc +++ b/doc/antora/modules/raddb/pages/mods-available/unpack.adoc @@ -19,15 +19,15 @@ NOTE: The module is useful only for `xlat`. To use it, add it to the `raddb/mods-enabled/` directory. Then, use it on the right-hand side of a variable assignment. - %{unpack: } + %(unpack: ) The arguments are three fields: data:: -Either `&Attribute-Name` the name of the attribute to unpack. -MUST be a `string` or `octets` type. -or 0xabcdef e.g. hex data. +Either `octets` or `string` type data, litteral or expanded attributes. +If `string` type data contains a representaion of hex data, e.g. 0xabcdef +that is first converted to `octets`. offset:: @@ -44,7 +44,7 @@ the data type to unpack at that offset. e.g. `integer`, `ipaddr`, `byte`, `short if we have `Class = 0x00000001020304`, then - %{unpack:&Class 4 uint16} + %(unpack:%{Class} 4 uint16) will unpack octets `4` and `5` as a `uint16`, which has value `0x0304`. diff --git a/raddb/mods-available/unpack b/raddb/mods-available/unpack index ff5e37b88bd..30944e428d2 100644 --- a/raddb/mods-available/unpack +++ b/raddb/mods-available/unpack @@ -22,15 +22,15 @@ # To use it, add it to the `raddb/mods-enabled/` directory. Then, # use it on the right-hand side of a variable assignment. # -# %{unpack: } +# %(unpack: ) # # The arguments are three fields: # # data:: # -# Either `&Attribute-Name` the name of the attribute to unpack. -# MUST be a `string` or `octets` type. -# or 0xabcdef e.g. hex data. +# Either `octets` or `string` type data, litteral or expanded attributes. +# If `string` type data contains a representaion of hex data, e.g. 0xabcdef +# that is first converted to `octets`. # # offset:: # @@ -47,7 +47,7 @@ # # if we have `Class = 0x00000001020304`, then # -# %{unpack:&Class 4 uint16} +# %(unpack:%{Class} 4 uint16) # # will unpack octets `4` and `5` as a `uint16`, which has value `0x0304`. # diff --git a/src/modules/rlm_unpack/rlm_unpack.c b/src/modules/rlm_unpack/rlm_unpack.c index 3921881be02..7b24f379f77 100644 --- a/src/modules/rlm_unpack/rlm_unpack.c +++ b/src/modules/rlm_unpack/rlm_unpack.c @@ -58,7 +58,7 @@ static xlat_arg_parser_t const unpack_xlat_args[] = { * * Example: @verbatim -%{unpack:&Class 0 integer} +%(unpack:%{Class} 0 integer) @endverbatim * Expands Class, treating octet at offset 0 (bytes 0-3) as an "integer". *