aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-05-14 14:29:12 +1000
committerDenys Vlasenko <vda.linux@googlemail.com>2018-05-14 10:46:00 +0200
commit23cbd7d5bbbf8f5fb65d1ff3a92323f2bb300f63 (patch)
tree67e6d49b0ef4870192cb63837e248ba666ff452b
parentbcdec1a8b8bf9fb3ea4de96d153b203e12e035fd (diff)
downloadbusybox-w32-23cbd7d5bbbf8f5fb65d1ff3a92323f2bb300f63.tar.gz
busybox-w32-23cbd7d5bbbf8f5fb65d1ff3a92323f2bb300f63.tar.bz2
busybox-w32-23cbd7d5bbbf8f5fb65d1ff3a92323f2bb300f63.zip
udhcpc6: add DHCPv6 boot options
Add support for 'bootfile-url' and 'bootfile-params' as defined by RFC5970 "DHCPv6 Options for Network Boot". Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/d6_common.h3
-rw-r--r--networking/udhcp/d6_dhcpc.c25
2 files changed, 28 insertions, 0 deletions
diff --git a/networking/udhcp/d6_common.h b/networking/udhcp/d6_common.h
index e9c0397ae..d0506e2bb 100644
--- a/networking/udhcp/d6_common.h
+++ b/networking/udhcp/d6_common.h
@@ -128,6 +128,9 @@ struct d6_option {
128#define D6_OPT_TZ_POSIX 41 128#define D6_OPT_TZ_POSIX 41
129#define D6_OPT_TZ_NAME 42 129#define D6_OPT_TZ_NAME 42
130 130
131#define D6_OPT_BOOT_URL 59
132#define D6_OPT_BOOT_PARAM 60
133
131/*** Other shared functions ***/ 134/*** Other shared functions ***/
132 135
133struct client6_data_t { 136struct client6_data_t {
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index fa1568b5f..f837bd549 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -38,6 +38,14 @@
38//config: help 38//config: help
39//config: You can request POSIX timezone with "-O tz" and timezone name 39//config: You can request POSIX timezone with "-O tz" and timezone name
40//config: with "-O timezone". 40//config: with "-O timezone".
41//config:
42//config:config FEATURE_UDHCPC6_RFC5970
43//config: bool "Support RFC 5970 (Network Boot)"
44//config: default y
45//config: depends on UDHCPC6
46//config: help
47//config: You can request bootfile-url with "-O bootfile_url" and
48//config: bootfile-params with "-O bootfile_params".
41 49
42//applet:IF_UDHCPC6(APPLET(udhcpc6, BB_DIR_USR_BIN, BB_SUID_DROP)) 50//applet:IF_UDHCPC6(APPLET(udhcpc6, BB_DIR_USR_BIN, BB_SUID_DROP))
43 51
@@ -71,6 +79,10 @@ static const struct dhcp_optflag d6_optflags[] = {
71 { OPTION_STRING, D6_OPT_TZ_POSIX }, 79 { OPTION_STRING, D6_OPT_TZ_POSIX },
72 { OPTION_STRING, D6_OPT_TZ_NAME }, 80 { OPTION_STRING, D6_OPT_TZ_NAME },
73#endif 81#endif
82#if ENABLE_FEATURE_UDHCPC6_RFC5970
83 { OPTION_STRING, D6_OPT_BOOT_URL },
84 { OPTION_STRING, D6_OPT_BOOT_PARAM },
85#endif
74 { 0, 0 } 86 { 0, 0 }
75}; 87};
76/* Must match d6_optflags[] order */ 88/* Must match d6_optflags[] order */
@@ -86,6 +98,11 @@ static const char d6_option_strings[] ALIGN1 =
86 "tz" "\0" /* D6_OPT_TZ_POSIX */ 98 "tz" "\0" /* D6_OPT_TZ_POSIX */
87 "timezone" "\0" /* D6_OPT_TZ_NAME */ 99 "timezone" "\0" /* D6_OPT_TZ_NAME */
88#endif 100#endif
101#if ENABLE_FEATURE_UDHCPC6_RFC5970
102 "bootfile_url" "\0" /* D6_OPT_BOOT_URL */
103 "bootfile_param" "\0" /* D6_OPT_BOOT_PARAM */
104#endif
105
89 "\0"; 106 "\0";
90 107
91#if ENABLE_LONG_OPTS 108#if ENABLE_LONG_OPTS
@@ -382,6 +399,14 @@ static void option_to_env(uint8_t *option, uint8_t *option_end)
382 *new_env() = xasprintf("tz_name=%.*s", (int)option[3], (char*)option + 4); 399 *new_env() = xasprintf("tz_name=%.*s", (int)option[3], (char*)option + 4);
383 break; 400 break;
384#endif 401#endif
402 case D6_OPT_BOOT_URL:
403 case D6_OPT_BOOT_PARAM:
404 {
405 char *tmp = string_option_to_env(option, option_end);
406 if (tmp)
407 *new_env() = tmp;
408 break;
409 }
385 } 410 }
386 len_m4 -= 4 + option[3]; 411 len_m4 -= 4 + option[3];
387 option += 4 + option[3]; 412 option += 4 + option[3];