From: Anshu Kumari <anskuma@redhat.com>
To: sbrivio@redhat.com, passt-dev@passt.top
Cc: anskuma@redhat.com, lvivier@redhat.com
Subject: [PATCH v8 4/6] dhcp: Add --dhcp-boot command-line option
Date: Mon, 26 Oct 2026 16:26:56 +0530 [thread overview]
Message-ID: <20261026105659.1585444-5-anskuma@redhat.com> (raw)
In-Reply-To: <20261026105659.1585444-1-anskuma@redhat.com>
Add --dhcp-boot FILE as convenience shorthand for --dhcp-opt 67,FILE.
Copy the boot file name into the 'file' header field of the BOOTP
message (RFC 2132, Section 9.5).
Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari <anskuma@redhat.com>
---
v8:
- --dhcp-boot now appears after --dhcp-opt
v7:
- moved ```has_bootfile``` declaration and initialization in
this patch.
v6:
- no changes.
v5:
- replaced conf_dhcp_option() to dhcp_set_opt().
v4:
- Changed argument name from URL to FILE in usage and man page.
- Fixed UEFI HTTP boot wording in man page
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 | 7 ++++++-
dhcp.c | 10 ++++++++++
passt.1 | 7 +++++++
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/conf.c b/conf.c
index e1366e01..4a078848 100644
--- a/conf.c
+++ b/conf.c
@@ -634,7 +634,8 @@ 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-opt CODE,VAL Set DHCP option CODE to VAL\n");
+ " --dhcp-opt CODE,VAL Set DHCP option CODE to VAL\n"
+ " --dhcp-boot FILE Boot file name for network boot\n");
if (strstr(name, "pasta"))
FPRINTF(f, " default: don't use any search list\n");
else
@@ -1324,6 +1325,7 @@ void conf(struct ctx *c, int argc, char **argv)
{"chroot-fallback", no_argument, NULL, 32 },
{"no-pidns", no_argument, NULL, 33 },
{"dhcp-opt", required_argument, NULL, 34 },
+ {"dhcp-boot", required_argument, NULL, 35 },
{ 0 },
};
const char *optstring = "+dqfel:hs:c:F:I:p:P:m:a:n:M:g:i:o:D:S:H:461t:u:T:U:";
@@ -1590,6 +1592,9 @@ void conf(struct ctx *c, int argc, char **argv)
dhcp_set_opt(optcode, p);
break;
+ case 35:
+ dhcp_set_opt(67, optarg);
+ break;
case 'd':
c->debug = 1;
c->quiet = 0;
diff --git a/dhcp.c b/dhcp.c
index fe06224a..73aa1a13 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -600,6 +600,7 @@ int dhcp(const struct ctx *c, struct iov_tail *data)
const struct udphdr *uh;
struct msg m_storage;
struct msg const *m;
+ bool has_bootfile;
struct msg reply;
unsigned int i;
@@ -772,8 +773,17 @@ int dhcp(const struct ctx *c, struct iov_tail *data)
if (!c->no_dhcp_dns_search)
opt_set_dns_search(c, sizeof(m->o));
+ /* RFC 2132, Section 9.5: put boot file name in the 'file' header
+ * field.
+ */
+ has_bootfile = opts[67].slen > 0 &&
+ (size_t)opts[67].slen < sizeof(reply.file);
+
dlen = offsetof(struct msg, o) + fill(&reply);
+ if (has_bootfile)
+ memcpy(reply.file, opts[67].s, opts[67].slen);
+
if (m->flags & FLAG_BROADCAST)
dst = in4addr_broadcast;
else
diff --git a/passt.1 b/passt.1
index dd9858ea..01760941 100644
--- a/passt.1
+++ b/passt.1
@@ -481,6 +481,13 @@ Only the following option codes are supported (unsupported codes cause an error)
67 (Bootfile Name), 252 (WPAD URL)
.RE
+.TP
+.BR \-\-dhcp-boot " " \fIfile
+Convenience shorthand for \fB\-\-dhcp-opt\fR 67,\fIfile\fR.
+Sets the boot file name (DHCP option 67) for network boot.
+For UEFI HTTP boot, the vendor class identifier also needs to be set using
+\fB\-\-dhcp-opt\fR 60,HTTPClient.
+
.TP
.BR \-t ", " \-\-tcp-ports " " \fIspec
Configure TCP port forwarding to guest or namespace. \fIspec\fR can be either:
--
2.55.0
next prev parent reply other threads:[~2026-10-26 10:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 10:56 [PATCH v8 0/6] Add --dhcp-boot and --dhcp-opt options Anshu Kumari
2026-10-26 10:56 ` [PATCH v8 1/6] dhcp: Refactor fill_one() to operate on a generic buffer Anshu Kumari
2026-10-26 10:56 ` [PATCH v8 2/6] dhcp: Add option configuration tracking with enum opt_conf Anshu Kumari
2026-10-26 10:56 ` [PATCH v8 3/6] dhcp: Add --dhcp-opt with option table and value parser Anshu Kumari
2026-10-26 10:56 ` Anshu Kumari [this message]
2026-10-26 10:56 ` [PATCH v8 5/6] dhcp: Add option overload Anshu Kumari
2026-10-26 10:56 ` [PATCH v8 6/6] dhcp: Add RFC 3396 option splitting for concatenation-requiring options Anshu Kumari
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=20261026105659.1585444-5-anskuma@redhat.com \
--to=anskuma@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).