From nobody Tue Sep 29 19:56:09 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hvTSn6QP9z6v4n3 for ; Tue, 29 Sep 2026 19:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hvTSn5kXQz4dFy for ; Tue, 29 Sep 2026 19:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790711769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lzD0oeLHRXxQc0lcN6CeDIQo8nlc7YbDD9wmvD3DNUY=; b=Xyo08ZCfKgxpiUVeAPoLzucmsd9imMi7IUkha58lBcfxQSwnfP6mJ/NO/0XqZLEHLxLKQB 5wGEOvVjNjwMakWtt3k3z3fB/dV5aNg60nNn8oaB9QnFM5Sqrs6fY4U7QyigmD8P6tsQo+ vGkzschVOkzAlrHOGqA/sGJePSh4f4tw+v5bBs0ruVhDcNGw6oITqsHblcX9M5eYbPNkyZ RkPHnIOMCJNiKqTMewnEChwO8Q2AvR9M3csboLIj6hZOtR4QhWDtAVUgM9iVTqssY/8sfN nA50Y8Ac8YRfprtZtRwFxKS8QB9Ww0rkoidJ+DSTPUWbaNS7SyioKjbvGGypVA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790711769; b=O7u1NkJyX8PhL3yhqOFxQDRWj7acd7vu9jo8642OkE2J4NOBX4YH14EsGK0hD8RO/dx5km d7AA8xYkhIIZopl6Rche3PxJMfayWveyQRqMfqFt10A1i5sKrSK7WXnVZbBwdx6QxgyAU2 xJ10Mm9mQ1uC5EpKTk1ooDHbGDvyodyI+18wB5BH5YOxP/e7+uNA9eXg/a2mg8FErqYU7X 8KERitN2xkhUcus0jhs/g4TmKW+en6j9vSmmQpXhVsQGZpxOLjStMKTYXQa3nQvbMv4rYp dbj5W8ohjEhpIDA2z+Fy08WW7/bBkngTBsMnsxAsbhkWinKC57dnxEqSV4UVJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790711769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lzD0oeLHRXxQc0lcN6CeDIQo8nlc7YbDD9wmvD3DNUY=; b=mrEXGxA2UP98+Se90Fjmh6PAwi3j+2qj7r/TXSqBdv5oBJ/4zHzEv9s/LIumPAHseSbc89 E1OeD/+6KlETAa4mwOctXUqlMyCE51HQ8ErD5NQ3JBIyP/kIsL4aDd07F4K5v4qGRIKKrY jndLaW9yUFtznfCUOT9yLhvliyw2GjgfXcFQRJiEjOYYYEt91luwCqVlhhpWvJa8Qi7suY p02XXSwL2jPwc63iETFaz06fMHzgeLT6Qles6RIWKqfX9wMKZUlq0qtVnhj3b36xwqz81A HzB7ayQR10+Gm0AADkzxcgvueYfQ816n5RqxW4OKgF1nVbQ+jvu8BJ4meCMSHA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hvTSn4RXTz1Rgl for ; Tue, 29 Sep 2026 19:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 47ecd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 29 Sep 2026 19:56:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Krzysztof Galazka Subject: git: c4640126f116 - main - loader.efi: Apply command-line DHCP overrides earlier List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kgalazka X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4640126f1160c3eb939aa138445f4b4ea98efb0 Auto-Submitted: auto-generated Date: Tue, 29 Sep 2026 19:56:09 +0000 Message-Id: <6abc17d9.47ecd.766b7e9a@gitrepo.freebsd.org> The branch main has been updated by kgalazka: URL: https://cgit.FreeBSD.org/src/commit/?id=c4640126f1160c3eb939aa138445f4b4ea98efb0 commit c4640126f1160c3eb939aa138445f4b4ea98efb0 Author: Krzysztof Galazka AuthorDate: 2026-09-29 19:54:54 +0000 Commit: Krzysztof Galazka CommitDate: 2026-09-29 19:55:17 +0000 loader.efi: Apply command-line DHCP overrides earlier Ability to override DHCP options with command-line arguments was affected by intoduction of initmd support. Initmd discovery configures the network before loader arguments were parsed, so a dhcp.root-path override was unavailable during the first network configuration. Move parsing arguments earlier and apply dhcp.root-path even if DHCP response does not contain option 17. This allows providing a dynamic NFS root e.g. by chain loading loader.efi from iPXE. Signed-off-by: Krzysztof Galazka Reviewed by: imp Assisted by: Github Copilot (GPT-5.6 Sol) Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D59998 --- stand/common/dev_net.c | 3 +++ stand/efi/loader/main.c | 7 ++++++- stand/libsa/bootp.c | 4 +--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/stand/common/dev_net.c b/stand/common/dev_net.c index 897b09c648eb..aecb5bcde81c 100644 --- a/stand/common/dev_net.c +++ b/stand/common/dev_net.c @@ -248,6 +248,7 @@ static int net_getparams(int sock) { char buf[MAXHOSTNAMELEN]; + const char *val; n_long rootaddr, smask; #ifdef SUPPORT_BOOTP @@ -306,6 +307,8 @@ net_getparams(int sock) return (EIO); } exit: + if ((val = getenv("dhcp.root-path")) != NULL) + strlcpy(rootpath, val, sizeof(rootpath)); if ((rootaddr = net_parse_rootpath()) != htonl(INADDR_NONE)) rootip.s_addr = rootaddr; diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index fa4647101d62..bfb221ee80f5 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -1382,6 +1382,12 @@ main(int argc, CHAR16 *argv[]) devinit(); + /* + * Parse command line arguments before any operation that may configure + * the network so DHCP overrides are available on the first attempt. + */ + howto = parse_args(argc, argv); + /* * If we didn't find a ipxe image, and we're netbooting, try to * download an initmd that the dhcp server tells us about. @@ -1394,7 +1400,6 @@ main(int argc, CHAR16 *argv[]) * args (eg -h) or via the UEFI ConOut variable. */ has_kbd = has_keyboard(); - howto = parse_args(argc, argv); if (!has_kbd && (howto & RB_PROBE)) howto |= RB_SERIAL | RB_MULTIPLE; howto &= ~RB_PROBE; diff --git a/stand/libsa/bootp.c b/stand/libsa/bootp.c index f708006169d0..8cbcede7bb0e 100644 --- a/stand/libsa/bootp.c +++ b/stand/libsa/bootp.c @@ -474,9 +474,7 @@ vend_rfc1048(u_char *cp, u_int len) bcopy(cp, &rootip.s_addr, sizeof(rootip.s_addr)); } if (tag == TAG_ROOTPATH) { - if ((val = getenv("dhcp.root-path")) == NULL) - val = (const char *)cp; - strlcpy(rootpath, val, sizeof(rootpath)); + strlcpy(rootpath, (const char *)cp, sizeof(rootpath)); } if (tag == TAG_HOSTNAME) { if ((val = getenv("dhcp.host-name")) == NULL)