udhcp: support string user options, closes 10946
function old new delta
udhcp_str2optset 536 628 +92
packed_usage 32757 32760 +3
udhcpc_main 2708 2692 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 95/-16) Total: 79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 90b07bf..bd9e8fd 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1224,6 +1224,7 @@
//usage: "\n -x hostname:bbox - option 12"
//usage: "\n -x lease:3600 - option 51 (lease time)"
//usage: "\n -x 0x3d:0100BEEFC0FFEE - option 61 (client id)"
+//usage: "\n -x 14:'\"dumpfile\"' - option 14 (shell-quoted)"
//usage: "\n -F NAME Ask server to update DNS mapping for NAME"
//usage: "\n -V VENDOR Vendor identifier (default 'udhcp VERSION')"
//usage: "\n -C Don't send MAC as client identifier"
@@ -1335,15 +1336,9 @@
}
}
while (list_x) {
- char *optstr = llist_pop(&list_x);
- char *colon = strchr(optstr, ':');
- if (colon)
- *colon = ' ';
- /* now it looks similar to udhcpd's config file line:
- * "optname optval", using the common routine: */
+ char *optstr = xstrdup(llist_pop(&list_x));
udhcp_str2optset(optstr, &client_config.options, dhcp_optflags, dhcp_option_strings);
- if (colon)
- *colon = ':'; /* restore it for NOMMU reexec */
+ free(optstr);
}
if (udhcp_read_interface(client_config.interface,