udhcpc6: make -O OPT work

Patch is based on work by tiggerswelt.net.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2017-06-28 19:18:17 +02:00
parent ae2b9f286c
commit ba4fbca8a8
6 changed files with 149 additions and 58 deletions

View File

@ -361,6 +361,10 @@ static int FAST_FUNC read_staticlease(const char *const_line, void *arg)
return 1;
}
static int FAST_FUNC read_optset(const char *line, void *arg) {
return udhcp_str2optset(line, arg, dhcp_optflags, dhcp_option_strings);
}
struct config_keyword {
const char *keyword;
int (*handler)(const char *line, void *var) FAST_FUNC;
@ -387,8 +391,8 @@ static const struct config_keyword keywords[] = {
{"pidfile" , read_str , OFS(pidfile ), "/var/run/udhcpd.pid"},
{"siaddr" , udhcp_str2nip , OFS(siaddr_nip ), "0.0.0.0"},
/* keywords with no defaults must be last! */
{"option" , udhcp_str2optset, OFS(options ), ""},
{"opt" , udhcp_str2optset, OFS(options ), ""},
{"option" , read_optset , OFS(options ), ""},
{"opt" , read_optset , OFS(options ), ""},
{"notify_file" , read_str , OFS(notify_file ), NULL},
{"sname" , read_str , OFS(sname ), NULL},
{"boot_file" , read_str , OFS(boot_file ), NULL},