udhcpc: make -O <numeric_opt> work. Closes 5402

function                                             old     new   delta
udhcpc_main                                         2642    2685     +43
udhcp_recv_raw_packet                                414     415      +1
d6_recv_raw_packet                                   248     249      +1
udhcpc6_main                                        2430    2413     -17
add_client_options                                   239     213     -26
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 45/-43)              Total: 2 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2012-07-27 13:25:07 +02:00
parent 0e941d5427
commit 293c94564c
3 changed files with 21 additions and 13 deletions

View File

@@ -965,8 +965,6 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
SERVER_PORT = CLIENT_PORT - 1;
}
#endif
if (opt & OPT_o)
client_config.no_default_options = 1;
while (list_O) {
char *optstr = llist_pop(&list_O);
unsigned n = bb_strtou(optstr, NULL, 0);
@@ -976,6 +974,16 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
}
client_config.opt_mask[n >> 3] |= 1 << (n & 7);
}
if (!(opt & OPT_o)) {
/*
unsigned i, n;
for (i = 0; (n = dhcp_optflags[i].code) != 0; i++) {
if (dhcp_optflags[i].flags & OPTION_REQ) {
client_config.opt_mask[n >> 3] |= 1 << (n & 7);
}
}
*/
}
while (list_x) {
char *optstr = llist_pop(&list_x);
char *colon = strchr(optstr, ':');