[git commit] udhcpc6: add DHCPv6 boot options

Denys Vlasenko vda.linux at googlemail.com
Mon May 14 08:46:00 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=23cbd7d5bbbf8f5fb65d1ff3a92323f2bb300f63
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Add support for 'bootfile-url' and 'bootfile-params' as defined by
RFC5970 "DHCPv6 Options for Network Boot".

Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/udhcp/d6_common.h |  3 +++
 networking/udhcp/d6_dhcpc.c  | 25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

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 {
 #define D6_OPT_TZ_POSIX      41
 #define D6_OPT_TZ_NAME       42
 
+#define D6_OPT_BOOT_URL      59
+#define D6_OPT_BOOT_PARAM    60
+
 /*** Other shared functions ***/
 
 struct 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 @@
 //config:	help
 //config:	You can request POSIX timezone with "-O tz" and timezone name
 //config:	with "-O timezone".
+//config:
+//config:config FEATURE_UDHCPC6_RFC5970
+//config:	bool "Support RFC 5970 (Network Boot)"
+//config:	default y
+//config:	depends on UDHCPC6
+//config:	help
+//config:	You can request bootfile-url with "-O bootfile_url" and
+//config:	bootfile-params with "-O bootfile_params".
 
 //applet:IF_UDHCPC6(APPLET(udhcpc6, BB_DIR_USR_BIN, BB_SUID_DROP))
 
@@ -71,6 +79,10 @@ static const struct dhcp_optflag d6_optflags[] = {
 	{ OPTION_STRING,                                D6_OPT_TZ_POSIX },
 	{ OPTION_STRING,                                D6_OPT_TZ_NAME },
 #endif
+#if ENABLE_FEATURE_UDHCPC6_RFC5970
+	{ OPTION_STRING,                                D6_OPT_BOOT_URL },
+	{ OPTION_STRING,                                D6_OPT_BOOT_PARAM },
+#endif
 	{ 0, 0 }
 };
 /* Must match d6_optflags[] order */
@@ -86,6 +98,11 @@ static const char d6_option_strings[] ALIGN1 =
 	"tz" "\0"       /* D6_OPT_TZ_POSIX */
 	"timezone" "\0" /* D6_OPT_TZ_NAME */
 #endif
+#if ENABLE_FEATURE_UDHCPC6_RFC5970
+	"bootfile_url" "\0" /* D6_OPT_BOOT_URL */
+	"bootfile_param" "\0" /* D6_OPT_BOOT_PARAM */
+#endif
+
 	"\0";
 
 #if ENABLE_LONG_OPTS
@@ -382,6 +399,14 @@ static void option_to_env(uint8_t *option, uint8_t *option_end)
 			*new_env() = xasprintf("tz_name=%.*s", (int)option[3], (char*)option + 4);
 			break;
 #endif
+		case D6_OPT_BOOT_URL:
+		case D6_OPT_BOOT_PARAM:
+			{
+			char *tmp = string_option_to_env(option, option_end);
+			if (tmp)
+				*new_env() = tmp;
+			break;
+			}
 		}
 		len_m4 -= 4 + option[3];
 		option += 4 + option[3];


More information about the busybox-cvs mailing list