Introduce the --dhcp-boot flag that sets the boot file URL for
network boot specially for ipxe. This patch adds the option
storage and CLI parsing.
Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari
---
v2:
- Removed separate dhcp_boot[PATH_MAX] field — --dhcp-boot foo now stores into custom_opts[] as code 67 (same as --dhcp-opt 67,foo)
---
conf.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/conf.c b/conf.c
index 89d2127..ae8ee26 100644
--- a/conf.c
+++ b/conf.c
@@ -618,6 +618,7 @@ static void usage(const char *name, FILE *f, int status)
" a single, empty option disables the DNS search list\n"
" -H, --hostname NAME Hostname to configure client with\n"
" --fqdn NAME FQDN to configure client with\n"
+ " --dhcp-boot URL Boot file URL for network boot\n"
" --dhcp-opt CODE,VAL Set DHCP option by code\n");
if (strstr(name, "pasta"))
FPRINTF(f, " default: don't use any search list\n");
@@ -1239,6 +1240,7 @@ void conf(struct ctx *c, int argc, char **argv)
{"migrate-no-linger", no_argument, NULL, 30 },
{"stats", required_argument, NULL, 31 },
{"conf-path", required_argument, NULL, 'c' },
+ {"dhcp-boot", required_argument, NULL, 32 },
{"dhcp-opt", required_argument, NULL, 33 },
{ 0 },
};
@@ -1475,6 +1477,18 @@ void conf(struct ctx *c, int argc, char **argv)
die("Can't display statistics if not running in foreground");
c->stats = strtol(optarg, NULL, 0);
break;
+ case 32:
+ if (c->custom_opts_count >= MAX_CUSTOM_DHCP_OPTS)
+ die("Too many DHCP options (max %d)",
+ MAX_CUSTOM_DHCP_OPTS);
+
+ c->custom_opts[c->custom_opts_count].code = 67;
+ if (snprintf_check(c->custom_opts[c->custom_opts_count].str,
+ sizeof(c->custom_opts[0].str),
+ "%s", optarg))
+ die("Boot file name too long: %s", optarg);
+ c->custom_opts_count++;
+ break;
case 33:
comma = strchr(optarg, ',');
if (!comma)
--
2.54.0