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

Alan DeKok alan.dekok at inkbridge.io
Sat Sep 6 11:43:50 UTC 2025


On Sep 5, 2025, at 12:34 PM, Ľudovít Mikula <ludovit.mikula at mikori.sk> 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.




More information about the Freeradius-Users mailing list