summaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
diff options
context:
space:
mode:
authorDenys Vlasenko2010-03-27 23:23:41 +0100
committerDenys Vlasenko2010-03-27 23:23:41 +0100
commit9107b63a7fb80fcab0da71cf12e8c81dfc394d20 (patch)
tree566be6323a69a09949110349e720e33d7dd66fb2 /networking/udhcp/dhcpc.c
parentc2fdd41f5f97349f23b2a66592b9b29834faabaf (diff)
downloadbusybox-9107b63a7fb80fcab0da71cf12e8c81dfc394d20.zip
busybox-9107b63a7fb80fcab0da71cf12e8c81dfc394d20.tar.gz
udhcp: abort if we see unknown option, and show valid options if so
function old new delta udhcp_option_idx - 77 +77 udhcp_str2optset 366 351 -15 udhcpc_main 2845 2801 -44 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 77/-59) Total: 18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r--networking/udhcp/dhcpc.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 478ca5c..c36d418 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -879,21 +879,17 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
client_config.no_default_options = 1;
while (list_O) {
char *optstr = llist_pop(&list_O);
- int n = index_in_strings(dhcp_option_strings, optstr);
- if (n < 0)
- bb_error_msg_and_die("unknown option '%s'", optstr);
+ unsigned n = udhcp_option_idx(optstr);
n = dhcp_options[n].code;
client_config.opt_mask[n >> 3] |= 1 << (n & 7);
}
while (list_x) {
- int n;
+ unsigned n;
char *optstr = llist_pop(&list_x);
char *colon = strchr(optstr, ':');
if (colon)
*colon = '\0';
- n = index_in_strings(dhcp_option_strings, optstr);
- if (n < 0)
- bb_error_msg_and_die("unknown option '%s'", optstr);
+ n = udhcp_option_idx(optstr);
if (colon)
*colon = ' ';
udhcp_str2optset(optstr, &client_config.options);