udhcpc: add -x OPT:VAL option

function                                             old     new   delta
udhcp_str2optset                                       -     443    +443
add_client_options                                     -     160    +160
udhcpc_main                                         2753    2857    +104
packed_usage                                       26670   26689     +19
attach_option                                        380     385      +5
udhcpd_main                                         1964    1965      +1
udhcp_add_option_string                               94      86      -8
add_param_req_option                                 128       -    -128
read_opt                                             443       -    -443
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/1 up/down: 732/-579)          Total: 153 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2010-03-25 20:32:38 +01:00
parent 0454d9d6c3
commit 7e6add1dfc
7 changed files with 61 additions and 24 deletions

View File

@@ -145,7 +145,7 @@ static NOINLINE void attach_option(
}
/* read a dhcp option and add it to opt_list */
static int FAST_FUNC read_opt(const char *const_line, void *arg)
int FAST_FUNC udhcp_str2optset(const char *const_line, void *arg)
{
struct option_set **opt_list = arg;
char *opt, *val, *endptr;
@@ -292,8 +292,8 @@ static const struct config_keyword keywords[] = {
{"pidfile", read_str, &(server_config.pidfile), "/var/run/udhcpd.pid"},
{"siaddr", read_nip, &(server_config.siaddr_nip), "0.0.0.0"},
/* keywords with no defaults must be last! */
{"option", read_opt, &(server_config.options), ""},
{"opt", read_opt, &(server_config.options), ""},
{"option", udhcp_str2optset, &(server_config.options), ""},
{"opt", udhcp_str2optset, &(server_config.options), ""},
{"notify_file", read_str, &(server_config.notify_file), ""},
{"sname", read_str, &(server_config.sname), ""},
{"boot_file", read_str, &(server_config.boot_file), ""},