It is not possible with the current interface to specify a binary option at udhcpc. This is desirable since DHCP options such as Client ID are usually binary. This patch will convert command line input that starts with 0x... and is followed by hex to binary.
Forgot to attach the patch?
Created attachment 773 [details] DHCP binary options patch I don't know what happened. Those patches were there last time I checked. Anyway reattaching.
Simply special-casing "Ox" is not a clean implementation - now hostname "0xcart" is suddenly invalid (!). Moreover, it acts only on -h, -c and -V. I added support for adding any DHCP options, not just selected few (like -h,-c,-V,-F we had before) but any one using -x optname:optval syntax. This code reuses the same machinery which is employed by dhcp server to parse options from config file. Because of this, best way to add binary option is to add a bit of code in networking/udhcp/common.c, udhcp_str2optset() function. Currently, its start looks like this: opt = strtok(str, " \t="); if (!opt) return 0; option = &dhcp_options[udhcp_option_idx(opt)]; The last line parses "optname". If we'd insert a code if (optname is a number) { val = strtok(NULL, ", \t"); opt,length = parse_optval_as_a_hex_string(val); attach_option(opt_list, opt, length); return; } directly before it, both dhcp client and server would be able to use it: via -x "23:deadface" and "option 23 deadface" respectively.
Fixed in git, please test.
The idea looks good!