[PATCH] - Numeric DHCP option request facility

Nigel Hathaway Nigel.Hathaway at ubiquisys.com
Wed Jul 13 08:36:39 UTC 2011


Denys,

>On Tuesday 31 May 2011 17:37, Nigel Hathaway wrote:
>> Package: busybox
>> Version: v1.18.4
>> Severity: low
>> 
>> This patch applies on top of my previous VLAN and numeric DHCP option >recognition patch.
>> 
>> Whist this previous patch allows you to have DHCP options that are >unknown to Busybox to be passed numerically to the udhcpc script, I found >that there was no way of actually adding them to the list of requested >options passed to the DHCP server. This rectifies this in that you can now >request DHCP options by number. For example:
>> 
>> udhcpc -O43
>> 
>> This adds option 43 (vendor specific information) to the set of requested >options.
>
>I committed a smaller fix for now:
>
>diff -ad -urpN busybox.5/networking/udhcp/dhcpc.c >busybox.6/networking/udhcp/dhcpc.c
>--- busybox.5/networking/udhcp/dhcpc.c	2011-05-16 03:51:39.000000000 >+0200
>+++ busybox.6/networking/udhcp/dhcpc.c	2011-06-04 05:06:47.000000000 >+0200
>@@ -1134,8 +1134,11 @@ int udhcpc_main(int argc UNUSED_PARAM, c
> 		client_config.no_default_options = 1;
> 	while (list_O) {
> 		char *optstr = llist_pop(&list_O);
>-		unsigned n = udhcp_option_idx(optstr);
>-		n = dhcp_optflags[n].code;
>+		unsigned n = bb_strtou(optstr, NULL, 0);
>+		if (errno || n > 254) {
>+			n = udhcp_option_idx(optstr);
>+			n = dhcp_optflags[n].code;
>+		}
> 		client_config.opt_mask[n >> 3] |= 1 << (n & 7);
> 	}
> 	while (list_x) {
>
>
>Let me know if it's not enough.
>
Have you tested this? When I tried the same thing, any flag in the option 
mask array that didn't have a corresponding entry in the table just got 
ignored by add_client_options(), which is why my original patch had 2 parts 
to it.
>-- 
>>vda


More information about the busybox mailing list