From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ScNug4hq; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 0812F5A0271 for ; Thu, 08 Oct 2026 00:06:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791410786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k2i8htOvafiY+mj+Chbnf1dkfBY+J0hHOc/KOTgJiYU=; b=ScNug4hqrNiS8GdeIcGCrr1CozxQho5XYEMMaYH/EOCNMLavVN48WFeopuVE5NvKOPXAus 7CEpqDDvsYVgIocal42h1Nrxu71f68amzoQ+6IhT/9kj8piuEtkXas2vrMxBj2ZGpjbAjY j6F8k7Rrfu4MhGNekoLLQjB6Mez/ilY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-ay-gaGvmN-a1vAKmfh0oYg-1; Wed, 07 Oct 2026 18:06:24 -0400 X-MC-Unique: ay-gaGvmN-a1vAKmfh0oYg-1 X-Mimecast-MFC-AGG-ID: ay-gaGvmN-a1vAKmfh0oYg_1791410783 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4a0284121c6so34185345e9.3 for ; Wed, 07 Oct 2026 15:06:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791410783; x=1792015583; h=date:content-transfer-encoding:content-type:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=obFIHvrFe5x72VVmnwcr3xY5GUYG7DbmVXqsOL1BRhU=; b=YDcvZ1ugA33xn+gxiatZdiyGe9Nwpk29yTwYgH/AZEOLRV2W/6L69MaQSXBcOoiaF6 XUxq0jRMPJUt0TDKel6zcOZj8l64ynqql+gc78VXPTdW525q4Xz7q414eyfhEiKzMXyH tGIGvcUsbRIy71kBc3DzjcRu7ilnm/olFx+XjH5B0/FUnPL/mQY7JK2AsiHEKhu1vsac oJUB4JOk/Lg9ripUPjQbUQHJYhAyuA4aj0MKjpo4bdvzPsXi+MDTv5YDX+VlHgCjy3cs ZGJI84y8E6dZ2NuVI76605l720Cb8xxm95k7Ifko3r4T+lyMPyOo4k8VOBhMwBzYCh6i m4MQ== X-Gm-Message-State: AFuF++nO8PA4kYTlD5mxQzoKYTiK1gON9FC+QZXEZts4eCPIPsJQ7Dj9 qf0pFz+MPyQ7LuUtSgJwlJDLBmjps7HvGcMbWKyOmLLV4jgVD7DEkwAK8HOjfXkhkAW0MiemqJB f8A0mPUeY4RKmMtejqZGIHoY0/7vV80e2M3Qw66Z/0NwbZkORx0oW+6MDV3pZaIM+E/yEu3WqQw qiiUDOFD7Vu9hZv8YGiUyCr29m0jWVj3MedMNi X-Gm-Gg: AYBFou1Fmo1G6kxO5S6wSKKJPi7CgTmeiKgE18AU8D4uaylWX7Cr7xHs4PWGqgxXRxm 8fZB/6SyRCko55jFvkx6C6ySKKMqHjFmrEmR3hQHnbkz5yPrXyzcCCYB94hHRaT0xDTogGYInvZ 717QlJZ5nJDT2fmWDxemk7pqakREoZrphHCLV2Y8e2w57oEzQIkWLlF3LYjydqnFG6Iqs1H8+G9 QTqb1SKLBYVKVtgljgQ036gAKmmo+qtvOiWd+KzfmWgaQ02eNHGMm8doXHgdDyAQYxQJQpKLmKN sFsrVqYpgOlX1iIwyHqgkDM+blZedxbMog82qI4asz8vmSa9/FVQb08iX3s8QCtH9pGc8QCd7In AXIbJXuv9oQ== X-Received: by 2002:a05:600c:820f:b0:4a1:7367:5395 with SMTP id 5b1f17b1804b1-4a1802dc754mr66218005e9.2.1791410783357; Wed, 07 Oct 2026 15:06:23 -0700 (PDT) X-Received: by 2002:a05:600c:820f:b0:4a1:7367:5395 with SMTP id 5b1f17b1804b1-4a1802dc754mr66217405e9.2.1791410782742; Wed, 07 Oct 2026 15:06:22 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48c71d30603sm7754356f8f.49.2026.10.07.15.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2026 15:06:22 -0700 (PDT) From: Stefano Brivio To: Anshu Kumari Subject: Re: [PATCH v7 4/7] dhcp: Add --dhcp-boot command-line option Message-ID: <20261008000621.22f7f516@elisabeth> In-Reply-To: <20261001131602.653553-5-anskuma@redhat.com> References: <20261001131602.653553-1-anskuma@redhat.com> <20261001131602.653553-5-anskuma@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Thu, 08 Oct 2026 00:06:21 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: jl_cnCy4j_j2hR4W60qwi3cgOp4RK-zTP8h1xny40cQ_1791410783 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: W3NADBK2DR47I2E4FANNDBPFEJTMICT4 X-Message-ID-Hash: W3NADBK2DR47I2E4FANNDBPFEJTMICT4 X-MailFrom: sbrivio@redhat.com 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, lvivier@redhat.com 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: On Thu, 1 Oct 2026 18:45:57 +0530 Anshu Kumari wrote: > Add a convenience shorthand --dhcp-boot FILE that sets the boot > file name (DHCP option 67) for network boot. This is equivalent > to --dhcp-opt 67,FILE. >=20 > Per RFC 2132, Section 9.5, the boot file name is placed in the > 'file' header field of the DHCP reply. >=20 > Link: https://bugs.passt.top/show_bug.cgi?id=3D192 > Signed-off-by: Anshu Kumari > --- > v7: > - moved ```has_bootfile``` declaration and initialization in > this patch. >=20 > v6: > - no changes. >=20 > v5: > - replaced conf_dhcp_option() to dhcp_set_opt(). >=20 > v4: > - Changed argument name from URL to FILE in usage and man page. > - Fixed UEFI HTTP boot wording in man page >=20 > 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. >=20 > v2: > - Removed separate dhcp_boot[PATH_MAX] field =E2=80=94 --dhcp-boot foo > now stores into custom_opts[] as code 67 (same as --dhcp-opt 67,foo) > --- > conf.c | 5 +++++ > dhcp.c | 10 ++++++++++ > passt.1 | 7 +++++++ > 3 files changed, 22 insertions(+) >=20 > diff --git a/conf.c b/conf.c > index c12a9335..37720bb5 100644 > --- a/conf.c > +++ b/conf.c > @@ -634,6 +634,7 @@ static void usage(const char *name, FILE *f, int stat= us) > =09=09" a single, empty option disables the DNS search list\n" > =09=09" -H, --hostname NAME =09Hostname to configure client with\n" > =09=09" --fqdn NAME=09=09FQDN to configure client with\n" > +=09=09" --dhcp-boot FILE=09Boot file name for network boot\n" > =09=09" --dhcp-opt CODE,VAL=09Set DHCP option CODE to VAL\n"); > =09if (strstr(name, "pasta")) > =09=09FPRINTF(f, " default: don't use any search list\n"); > @@ -1354,6 +1355,7 @@ void conf(struct ctx *c, int argc, char **argv) > =09=09{"stats", required_argument,=09=09NULL,=09=0931 }, > =09=09{"conf-path",=09required_argument,=09NULL,=09=09'c' }, > =09=09{"chroot-fallback", no_argument,=09NULL, =09=0932 }, > +=09=09{"dhcp-boot", required_argument,=09NULL,=09=0933 }, > =09=09{"dhcp-opt", required_argument,=09=09NULL,=09=0934 }, > =09=09{ 0 }, > =09}; > @@ -1596,6 +1598,9 @@ void conf(struct ctx *c, int argc, char **argv) > =09=09case 32: > =09=09=09c->chroot_fallback =3D true; > =09=09=09break; > +=09=09case 33: > +=09=09=09dhcp_set_opt(67, optarg); > +=09=09=09break; > =09=09case 34: { > =09=09=09unsigned long optcode; > =20 > diff --git a/dhcp.c b/dhcp.c > index dd3ab6c6..4dccae7b 100644 > --- a/dhcp.c > +++ b/dhcp.c > @@ -600,6 +600,7 @@ int dhcp(const struct ctx *c, struct iov_tail *data) > =09const struct udphdr *uh; > =09struct msg m_storage; > =09struct msg const *m; > +=09bool has_bootfile; > =09struct msg reply; > =09unsigned int i; > =20 > @@ -772,8 +773,17 @@ int dhcp(const struct ctx *c, struct iov_tail *data) > =09if (!c->no_dhcp_dns_search) > =09=09opt_set_dns_search(c, sizeof(m->o)); > =20 > +=09/* RFC 2132, Section 9.5: put boot file name in the 'file' header > +=09 * field. > +=09 */ > +=09has_bootfile =3D opts[67].slen > 0 && > +=09=09 (size_t)opts[67].slen < sizeof(reply.file); > + > =09dlen =3D offsetof(struct msg, o) + fill(&reply); > =20 > +=09if (has_bootfile) > +=09=09memcpy(reply.file, opts[67].s, opts[67].slen); > + > =09if (m->flags & FLAG_BROADCAST) > =09=09dst =3D in4addr_broadcast; > =09else > diff --git a/passt.1 b/passt.1 > index 2bfe7d50..fdbe3d2c 100644 > --- a/passt.1 > +++ b/passt.1 > @@ -440,6 +440,13 @@ Send \fIname\fR as DHCP option 12 (hostname). > FQDN to configure the client with. > Send \fIname\fR as Client FQDN: DHCP option 81 and DHCPv6 option 39. > =20 > +.TP > +.BR \-\-dhcp-boot " " \fIfile Given that options in conf() need to be renumbered anyway because of the merge conflict, what about moving this after --dhcp-opt in the documentation (it refers to it and it's a special case of it, so it would look more natural to have it afterwards) and then make ordering consistent in conf() and usage message? > +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 usi= ng > +\fB\-\-dhcp-opt\fR 60,HTTPClient. > + > .TP > .BR \-\-dhcp-opt " " \fICODE\fR,\fIVALUE\fR > Set DHCP option \fICODE\fR (1\-254) to \fIVALUE\fR. The value format dep= ends --=20 Stefano