aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorAnshu Kumari <anskuma@redhat.com>2026-10-26 16:26:56 +0530
committerStefano Brivio <sbrivio@redhat.com>2026-11-10 23:03:09 +0100
commit4901b1cff81c9314ce2f50fedfde938c4104b97c (patch)
tree78f4aec0c0b73f0b4f183a1d018058e73c5471ea
parent5e00f7ac41b1e0d3c85106ac8dc78fd216a93529 (diff)
downloadpasst-4901b1cff81c9314ce2f50fedfde938c4104b97c.tar
passt-4901b1cff81c9314ce2f50fedfde938c4104b97c.tar.gz
passt-4901b1cff81c9314ce2f50fedfde938c4104b97c.tar.bz2
passt-4901b1cff81c9314ce2f50fedfde938c4104b97c.tar.lz
passt-4901b1cff81c9314ce2f50fedfde938c4104b97c.tar.xz
passt-4901b1cff81c9314ce2f50fedfde938c4104b97c.tar.zst
passt-4901b1cff81c9314ce2f50fedfde938c4104b97c.zip
dhcp: Add --dhcp-boot command-line option
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> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--conf.c7
-rw-r--r--dhcp.c10
-rw-r--r--passt.17
3 files changed, 23 insertions, 1 deletions
diff --git a/conf.c b/conf.c
index e1366e0..4a07884 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 fe06224..73aa1a1 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 dd9858e..0176094 100644
--- a/passt.1
+++ b/passt.1
@@ -482,6 +482,13 @@ Only the following option codes are supported (unsupported codes cause an error)
.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:
.RS