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
---
v3:
- case 32 now calls dhcp_add_option(c, 67, optarg).
- Handles duplicate codes: --dhcp-boot and --dhcp-opt 67 coexist
correctly, last value wins.
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 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/conf.c b/conf.c
index ce78af1..f7281e2 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,9 @@ 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:
+ dhcp_add_option(c, 67, optarg);
+ break;
case 33:
comma = strchr(optarg, ',');
if (!comma)
--
2.54.0