My telepathic powers say that you are trying to fix the handling
of -c CLIENTID option.

For those lucky 99,999% who never needed to know about it:
CLIENTID has the following format: 1 byte of hwtype
(1 for ethernet), followed by hw address (usually 6-byte MAC).

------rfc2132.txt------
9.14. Client-identifier

   This option is used by DHCP clients to specify their unique
   identifier.  DHCP servers use this value to index their database of
   address bindings.  This value is expected to be unique for all
   clients in an administrative domain.

   Identifiers SHOULD be treated as opaque objects by DHCP servers.

   The client identifier MAY consist of type-value pairs similar to the
   'htype'/'chaddr' fields defined in [3]. For instance, it MAY consist
   of a hardware type and hardware address. In this case the type field
   SHOULD be one of the ARP hardware types defined in STD2 [22].  A
   hardware type of 0 (zero) should be used when the value field
   contains an identifier other than a hardware address (e.g. a fully
   qualified domain name).

   For correct identification of clients, each client's client-
   identifier MUST be unique among the client-identifiers used on the
   subnet to which the client is attached.  Vendors and system
   administrators are responsible for choosing client-identifiers that
   meet this requirement for uniqueness.

   The code for this option is 61, and its minimum length is 2.
------------

But -c PARAM treats PARAM simply as a string, which is not
the best format to pass binary data. Thus, we have a bug:
-c is badly implemented.

The problem is, if we change PARAM's format for -c, we break
compat with whoever is using this option now.

One method is to simply *drop* support for -c, since it is such
an obscure thing and users rarely need to weak it anyway,
and if they do need to tweak it, now we have shiny new
-x OPT:VAL thingy:

-x 0x3d:01ffc0ffeeface   or    -x 61:01ffc0ffeeface

will happily set option 0x3d (61) to the desired binary data.

Back to patch. It breaks indentation:

-       if (opt & OPT_c)
+       if (opt & OPT_c) {
+               if (opt & OPT_w) {
+                       client_config.clientid =
alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 1);
+                       client_config.clientid[2] = hwtype & 255;
+               } else {
                client_config.clientid =
alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 0);
+               }
+    }


-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to