PATCH: udhcpc -- don't request set of options by default
Denys Vlasenko
vda.linux at googlemail.com
Tue Apr 1 23:51:08 UTC 2008
On Tuesday 01 April 2008 23:09, L. Gabriel Somlo wrote:
> Denys & All,
>
> I noticed that udhcpc sends a default list of options in its request
> (i.e., all options listed with flag OPTION_REQ in options.c)
>
> That's bad, at least when used with some versions of isc dhcpd, which
> will only include the requested options in a reply.
>
> I know about the -O flag that can get udhcpc to request extra options,
> but what if I want to see options I didn't think about asking for ?
> Including a default option list in the request will always preclude me
> from seeing options I didn't know to ask for.
USE_FEATURE_UDHCPC_ARPING( \
"\n -a,--arping Use arping to validate offered address" \
) \
+ "\n -o,--no-default-options Do not request options by default" \
) \
SKIP_GETOPT_LONG( \
SKIP_GETOPT_LONG case also needs -o covered.
- "O:"
+ "O:o:"
-o does not take a param, should be "O:o".
packet->options[end + OPT_CODE] = DHCP_PARAM_REQ;
for (i = 0; (c = dhcp_options[i].code) != 0; i++) {
- if ((dhcp_options[i].flags & OPTION_REQ)
+ if (((dhcp_options[i].flags & OPTION_REQ) && !client_config.no_default_options) //vda
|| (client_config.opt_mask[c >> 3] & (1 << (c & 7)))
) {
packet->options[end + OPT_DATA + len] = c;
len++;
}
so, you create "empty" DHCP_PARAM_REQ. Why not just omitting it
at all like this?
- add_param_req_option(&packet);
+ if (!client_config.no_default_options)
+ add_param_req_option(&packet);
> I've added the '-o' command line flag to udhcpc, which inhibits
> inclusion of default options in the request. Options can still be
> explicitly requested with -O.
I am thinking - maybe we should just junk the idea of "default"
options to ask for? We can ask user to always provide explicit
list of -O OPTs to ask. What do you think?
> I have also added a mechanism to request '-o' (actually, its long form
> --no-default-options) from ifupdown's /etc/network/interfaces:
>
> auto eth0
> iface eth0 inet dhcp
> nodefaultopts --no-default-options
Please take a look at attached patch - will this work for you?
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 4.patch
Type: text/x-diff
Size: 6718 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080402/d7f5b6d6/attachment.bin
More information about the busybox
mailing list