From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=MmcgMAWS; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 817145A0269 for ; Tue, 07 Apr 2026 05:58:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1775534334; bh=CX0ZbYqLFBoHfLsj8wa43Ft4Hm3+L7aaMpVIQPdtK0w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MmcgMAWSQmYAnbHO0bD1UrXt2octSSoqI9E7pdTXTNyOHEjgM6tTIhCsF5nMJLgrL i0timHPlT/rNeSP3boUL9bDlRWNKsWPkBNIi6j0PywMM+c95FyZ3nkTsnsKO9FYGkf xOV1Q4F8qxLDY6Fv4gLZUtN0JgHR6CL/vzkqe8pbmb+vv0u1/Jqa7R99Et+PICLvHG MCWGtTiCoFv/rDRX/yUHeIAMk4LQwJSbGzqaXXdcnkvVE6AE1Pz48YiR0khBCP9mTT nx4cZhXe2v2m7jW5m3jRzkBiBM7DCm10Yc4wgV/TQBli1lTkbDjrw8O8Y3zcX8q2Xd SqKCizJX2Cu3Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fqXW26Lnvz4wL7; Tue, 07 Apr 2026 13:58:54 +1000 (AEST) Date: Tue, 7 Apr 2026 13:46:01 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 2/2] dhcp: Add --dhcp-boot option to set boot filename in DHCP replies Message-ID: References: <20260403080204.2364581-1-lvivier@redhat.com> <20260403080204.2364581-3-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fjmtf+qqAk4NGDYK" Content-Disposition: inline In-Reply-To: <20260403080204.2364581-3-lvivier@redhat.com> Message-ID-Hash: FNYGLRADN4IARDW5MHE6X6AEMVYGGAEI X-Message-ID-Hash: FNYGLRADN4IARDW5MHE6X6AEMVYGGAEI X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --fjmtf+qqAk4NGDYK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 03, 2026 at 10:02:04AM +0200, Laurent Vivier wrote: > Add a --dhcp-boot option that populates the 'file' field in DHCP reply > messages with the given filename. >=20 > Using --dhcp-boot together with --no-dhcp is rejected at startup. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > conf.c | 10 ++++++++++ > dhcp.c | 5 ++++- > passt.1 | 6 ++++++ > passt.h | 1 + > 4 files changed, 21 insertions(+), 1 deletion(-) >=20 > diff --git a/conf.c b/conf.c > index ae37bf96dac4..2cf1bc7420d3 100644 > --- a/conf.c > +++ b/conf.c > @@ -984,6 +984,7 @@ static void usage(const char *name, FILE *f, int stat= us) > " --no-udp Disable UDP protocol handler\n" > " --no-icmp Disable ICMP/ICMPv6 protocol handler\n" > " --no-dhcp Disable DHCP server\n" > + " --dhcp-boot FILE DHCP boot filename option\n" > " --no-ndp Disable NDP responses\n" > " --no-dhcpv6 Disable DHCPv6 server\n" > " --no-ra Disable router advertisements\n" > @@ -1537,6 +1538,7 @@ void conf(struct ctx *c, int argc, char **argv) > {"migrate-exit", no_argument, NULL, 29 }, > {"migrate-no-linger", no_argument, NULL, 30 }, > {"stats", required_argument, NULL, 31 }, > + {"dhcp-boot", required_argument, NULL, 32 }, > { 0 }, > }; > const char *optstring =3D "+dqfel:hs:F:I:p:P:m:a:n:M:g:i:o:D:S:H:461t:u= :T:U:"; > @@ -1775,6 +1777,11 @@ void conf(struct ctx *c, int argc, char **argv) > die("Can't display statistics if not running in foreground"); > c->stats =3D strtol(optarg, NULL, 0); > break; > + case 32: > + if (snprintf_check(c->dhcp_boot, sizeof(c->dhcp_boot), > + "%s", optarg)) > + die("Invalid DHCP bootfile name: %s", optarg); > + break; > case 'd': > c->debug =3D 1; > c->quiet =3D 0; > @@ -2206,6 +2213,9 @@ void conf(struct ctx *c, int argc, char **argv) > c->no_dhcpv6 =3D 1; > } > =20 > + if (c->no_dhcp && c->dhcp_boot[0]) > + die("--dhcp-boot cannot be used with --no-dhcp"); > + > get_dns(c); > =20 > if (!*c->pasta_ifn) { > diff --git a/dhcp.c b/dhcp.c > index 1ff8cba9f93d..7fdb6e051dec 100644 > --- a/dhcp.c > +++ b/dhcp.c > @@ -344,6 +344,9 @@ int dhcp(const struct ctx *c, struct iov_tail *data) > m->op !=3D BOOTREQUEST) > return -1; > =20 > + static_assert(sizeof(reply.file) =3D=3D sizeof(c->dhcp_boot), > + "dhcp_boot must have the same size as reply.file"); > + > reply.op =3D BOOTREPLY; > reply.htype =3D m->htype; > reply.hlen =3D m->hlen; > @@ -357,7 +360,7 @@ int dhcp(const struct ctx *c, struct iov_tail *data) > reply.giaddr =3D m->giaddr; > memcpy(&reply.chaddr, m->chaddr, sizeof(reply.chaddr)); > memset(&reply.sname, 0, sizeof(reply.sname)); > - memset(&reply.file, 0, sizeof(reply.file)); > + memcpy(&reply.file, c->dhcp_boot, sizeof(reply.file)); > reply.magic =3D m->magic; > =20 > for (i =3D 0; i < ARRAY_SIZE(opts); i++) > diff --git a/passt.1 b/passt.1 > index 13e8df9de9f3..a6ac2884bf3f 100644 > --- a/passt.1 > +++ b/passt.1 > @@ -342,6 +342,12 @@ Disable the DHCP server. DHCP client requests coming= from guest or target > namespace will be silently dropped. Implied if there is no gateway on the > selected IPv4 default route. > =20 > +.TP > +.BR \-\-dhcp-boot " " \fIfile > +Set the boot filename in DHCP replies to \fIfile\fR. This populates the > +\fIfile\fR field in BOOTP/DHCP reply messages, which can be used for > +network booting (PXE). Cannot be used with \fB--no-dhcp\fR. > + > .TP > .BR \-\-no-ndp > Disable Neighbor Discovery. NDP messages coming from guest or target > diff --git a/passt.h b/passt.h > index 62b8dcdf0a41..4044a4c07ea3 100644 > --- a/passt.h > +++ b/passt.h > @@ -255,6 +255,7 @@ struct ctx { > =20 > char hostname[PASST_MAXDNAME]; > char fqdn[PASST_MAXDNAME]; > + char dhcp_boot[128]; > =20 > int ifi6; > struct ip6_ctx ip6; > --=20 > 2.53.0 >=20 --=20 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 --fjmtf+qqAk4NGDYK Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmnUffgACgkQzQJF27ox 2Gf5qw//eW/egJaw5Udfc/EcO5GNaIrwE/z0kpse1QXHMx2zovflVGOin0elKjr1 DtEsnhI2S0eEsr23P3McfKxbKk+vTLmVyzNWL2P1vGqsrcW0TejzAHXdZWJtlvbv 5S8i7+w6CUMEH6/9e5hI9TjCyVC12buffYt197J0EVKY6Kh4Gw1deqRWw2QtoU/7 +zNnkQTGwDCfhU5zxNAMdTnMoLuiO5Ov0Ea/qS58+3Ds+T75y2ZCS9T0P4gzboXn r9gPy1fc8zg4bfm12Hzn2Rj3T6l8rm9VrtzQRyLMTkvoW0/hQ27ofkeArBFzJ+jq j7/8solwa+p1VDGg0KnG9+D6nEc5lsYBaU6058F0nijOgySwVmvoCXD1x5KdrXOs qbFR98bzZHmP+fveAFPJHooY3TltOXdv977jg9tchQ4e1ECw5DI1t09vvvXW2nM1 B9WxRAB7perC83CG70gdniF2ppGmSJw4Z8bkfLslTag+2lVpjBFd70+PgXH9DtF7 thDtRwOw6nt9Kw/+slo1yB2vSWf2OeYsTqPeCMSK2M1hUI+y9dqia2VdRRMcqySU 9vELztZUFdK8jjin8H5udLbHs2idYq9joxpHrUc6+LB92Z2KVwoUKzqbN4ur5BWf /ZiPQRWWje2hJNff4RZ/tuHOnlQpbBlT3iRIgiBYfW26TY6MeXs= =jQiU -----END PGP SIGNATURE----- --fjmtf+qqAk4NGDYK--