From: David Gibson <david@gibson.dropbear.id.au>
To: Anshu Kumari <anskuma@redhat.com>
Cc: sbrivio@redhat.com, passt-dev@passt.top, lvivier@redhat.com,
jmaloy@redhat.com
Subject: Re: [PATCH 2/6] conf: Add --dhcp-boot command-line option
Date: Tue, 19 May 2026 15:35:35 +1000 [thread overview]
Message-ID: <agv2pwUbX1nYId9w@zatzit> (raw)
In-Reply-To: <20260518132002.418296-3-anskuma@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2978 bytes --]
On Mon, May 18, 2026 at 06:49:58PM +0530, Anshu Kumari wrote:
> 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 <anskuma@redhat.com>
> ---
> conf.c | 9 +++++++++
> passt.h | 1 +
> 2 files changed, 10 insertions(+)
>
> diff --git a/conf.c b/conf.c
> index 2624e58..61a393f 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");
> @@ -846,6 +847,8 @@ static void conf_print(const struct ctx *c)
> info(" router: %s",
> inet_ntop(AF_INET, &c->ip4.guest_gw,
> buf, sizeof(buf)));
> + if (c->dhcp_boot[0])
> + info(" boot file: %s", c->dhcp_boot);
> for (i = 0; i < c->custom_opts_count; i++)
> info(" option %u: %s",
> c->custom_opts[i].code,
> @@ -1239,6 +1242,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 },
> };
> @@ -1472,6 +1476,11 @@ 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 (snprintf_check(c->dhcp_boot, sizeof(c->dhcp_boot),
> + "%s", optarg))
> + die("Boot file name too long: %s", optarg);
> + break;
IIUC, --dhcp-boot foo is equivalent to --dhcp-opt 67,foo
Is that right? If so, it would be preferable to make that more
explicit in the code, using a single way of storing the options and a
common "Add dhcp option helper" that's called from both the
--dhcp-boot and --dhcp-opt handling.
> case 33: {
> unsigned long code;
> const char *comma;
> diff --git a/passt.h b/passt.h
> index acb57dd..2354a0f 100644
> --- a/passt.h
> +++ b/passt.h
> @@ -262,6 +262,7 @@ struct ctx {
>
> char hostname[PASST_MAXDNAME];
> char fqdn[PASST_MAXDNAME];
> + char dhcp_boot[PATH_MAX];
>
> #define MAX_CUSTOM_DHCP_OPTS 32
>
> --
> 2.54.0
>
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-05-19 6:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 13:19 [PATCH 0/6] Add --dhcp-boot and --dhcp-opt options Anshu Kumari
2026-05-18 13:19 ` [PATCH 1/6] conf: Add --dhcp-opt command-line option Anshu Kumari
2026-05-18 13:19 ` [PATCH 2/6] conf: Add --dhcp-boot " Anshu Kumari
2026-05-18 13:19 ` [PATCH 3/6] dhcp: Add option type table and value parser Anshu Kumari
2026-05-18 13:20 ` [PATCH 4/6] dhcp: Refactor fill_one() to operate on a generic buffer Anshu Kumari
2026-05-18 13:20 ` [PATCH 5/6] dhcp: Add option overload Anshu Kumari
2026-05-18 13:20 ` [PATCH 6/6] doc: Add --dhcp-boot and --dhcp-opt to man page Anshu Kumari
2026-05-19 6:11 ` [PATCH 5/6] dhcp: Add option overload David Gibson
2026-05-19 6:02 ` [PATCH 4/6] dhcp: Refactor fill_one() to operate on a generic buffer David Gibson
2026-05-19 5:59 ` [PATCH 3/6] dhcp: Add option type table and value parser David Gibson
2026-05-19 5:35 ` David Gibson [this message]
2026-05-19 5:33 ` [PATCH 1/6] conf: Add --dhcp-opt command-line option David Gibson
2026-05-19 5:30 ` [PATCH 0/6] Add --dhcp-boot and --dhcp-opt options David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=agv2pwUbX1nYId9w@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=anskuma@redhat.com \
--cc=jmaloy@redhat.com \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).