Re: How to extract vendor specific information from Sub-Option 9 of Option 82

Alan DeKok via Freeradius-Users <[email protected]> Sat, 6 Sep 2025 07:43:50 -0400
Newsgroups gmane.comp.freeradius.user
Message-ID <[email protected]>
On Sep 5, 2025, at 12:34 PM, Ľudovít Mikula <[email protected]> wrote:
> The expand of the unpack shows correct hex value of the data, but when assigned to Tmp-Octets-0, it's hex encoded again. It's not only printed to log that way, but actually stored as such. When I unpack first byte from Tmp-Octets-0 into an integer, it's returned as value 48 (hex 30) instead of 3 (hex 03):
> ..
> Is this by design?

  If you read the documentation for the unpack module:

#  When "octets(len)" is used, the output is printed as hex.  e.g. for
#  the above example with Class:
#
#	%{unpack:&Class 4 octets(4)}
#
#  Will return the hex string "02030405"

  It's not only by design, but it's documented behavior.

  If you want to assign that hex string to an attribute of type "octets", don't quote the string, but do add a "0x" in front of it, so that the parser knows that it should parse the hex data back to raw bytes.

  Alan DeKok.


-
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.