Every piece of information exchanged between the DHCP-Client and DHCP-Server is done via HEX-Encoded "options", indeed
But this is "internal behaviour" and should, ideally, never leak into userspace.
RouterOS already deals with this for a number of DHCP Options
All of those are either:
-
available as ASCII from the config and userspace variables, and hex-encoded when composing the DHCP-Offer
-
received hex-encoded over the "dhcp protocol", decoded , and exposed in userspace / piped into the receiving daemon (IP-Stack->interface, DNS, NTP, CAPWAP(131), ACS(43))...
Some of those are simple IP addresses, others, are hex-encoded-ascii-strings.
CAPWAP for instance expects IP data, even if it receives String data...
the two most obvious (and pertinent) examples i see are:
Option12 / Hostname (sent by the DHCP-Client as hex-encoded-ascii, decoded and exposed to RouterOS Userspace exclusivelly as a string)
Vendor Class ID (sent by the DHCP-Client as hex-encoded-ascii, decoded , exposed to RouterOS as a string, AND ALSO used for advanced "matching" in dhcp-scripts, always treated as a string.
See: DHCP - RouterOS - MikroTik Documentation
As far as i'm concerned, all userspace interactions only make sense in ASCII/String format.
And in the very special case of Option82 , in that RouterOS can be Server, Client, and "Agent"/Snooper
Server should be able to read, and expose to userspace, and locally match ASCII
Client could be able to "self identify" adding option82 in the DHCP-Request, (same as option12, but this case is kinda useless)
And in Agent/Snooper mode, things get complicated, and i can only see them wanting to keep this "hex only representation everywhere" for performance reasons...
But functionally-wise, the flow has to be something like :
ASIC intercepts DHCPREQUEST coming from client
ASIC sends this intercepted packet to CPU/RouterOS
Snooper Daemon is aware of packet's origin, so , injects identification data pulled from userspace/config
CPU sends this packet (now with origin attribution) back into the wire , towards DHCP-server
Here, there needs to be bidirectional translation.... the Snooper will receive HEX data, but will need to convert this into ASCII (for userspace and insertion into the "snooping table") if this feature is to have any real world usefulness
and again, the snooper has to have access to the userspace variables / identification template, in ascii-readable form, hex-encode and compose the option for injection.
that last point @fischerdouglas raised is orthogonal to all this:
to be able to interoperate with option82-based radius accounting, Mikrotik has , again , to implement the composition of the radius AV-Pair.
This is based on/ derived from, but almost never exactly, whatever the DHCP-Server received in the Option82 header...
So the DHCP-Server Daemon this time (not the snooper daemon that interacts with the ASIC) has to have it's own "composition template" infrastructure
In my head, this all has to happen in userspace, based off of string/ascii-type data, derived from the configuration database, physical port, hostname, etc...
Specifically the AV-Pairs, since those are directed at the RADIUS server, never need (nor should) be HEX encoded when exiting "RouterOS Userspace"-into-> Packet/Protocol layer