[Bug 735] Specifying a binary option in udhcpc is not possible

bugzilla at busybox.net bugzilla at busybox.net
Sun Apr 4 00:35:35 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=735





--- Comment #3 from Denys Vlasenko <vda.linux at googlemail.com>  2010-04-04 00:35:34 UTC ---
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.


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list