From nobody Thu Aug 21 06:57:26 2025 X-Original-To: dev-commits-src-all@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 4c6vK4342Bz65tnD for ; Thu, 21 Aug 2025 06:57:44 +0000 (UTC) (envelope-from tsoome@me.com) Received: from outbound.ci.icloud.com (p-east1-cluster1-host11-snip4-4.eps.apple.com [57.103.91.107]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4c6vK34q1Gz3vxV for ; Thu, 21 Aug 2025 06:57:43 +0000 (UTC) (envelope-from tsoome@me.com) Authentication-Results: mx1.freebsd.org; none Received: from outbound.ci.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-central-1k-100-percent-10 (Postfix) with ESMTPS id 0B31218002D9; Thu, 21 Aug 2025 06:57:39 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; bh=CGLWBM0fDgMJA7zevXyt9hh9fOdyb8T/Rymek/BkxzA=; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:To:x-icloud-hme; b=qpE+1nF6xe/ahEuS99/5zb2Z7yRtZxDhvbiFk522oaU5Q7iP0HLb/4ecsqN0jjbhVaFughFFPfNfkHsLlqbmywuZ/p89BAzmdFuzGkbkiMVuD9js9EUuPq9vZxJaJ9ExEEVAo0Fan8Z7ByZHuTTrlU06xBjPwo5ziN8R7HtEYnqUTmyQPd/QDPTC1u0IQ2xjsXAYZbnwXO6BM2Cw6q4AgobuUNug3FJGbHa61yTXW5cUNJvgGBJav7+r1E7TKknfCDOQDxcDye+Rct7oiLMiiEwhaaj5GU5mDed+rNTQ8QLDox0fi35VMbA7DSqb2VnbZcPEg/vWi0CSvqG2xydSaA== Received: from smtpclient.apple (ci-asmtp-me-k8s.p00.prod.me.com [17.57.156.36]) by p00-icloudmta-asmtp-us-central-1k-100-percent-10 (Postfix) with ESMTPSA id 4F40A180016D; Thu, 21 Aug 2025 06:57:38 +0000 (UTC) From: Toomas Soome Message-Id: <9EEDE524-1ED3-4F41-9584-460DCBF61D81@me.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_934F1BC3-226F-4DA7-AD5A-B9B3614F975F" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: git: b44cc1b479fe - main - loader: do not try to open directories with TFTP Date: Thu, 21 Aug 2025 09:57:26 +0300 In-Reply-To: <8006s3o4-3nns-509q-n89q-oq88r8o09sn8@SerrOFQ.bet> Cc: A FreeBSD User , "Simon J. Gerraty" , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: "Bjoern A. Zeeb" References: <202508202248.57KMmcTO016280@gitrepo.freebsd.org> <20250821060752.001c9599@thor.sb211.local> <8006s3o4-3nns-509q-n89q-oq88r8o09sn8@SerrOFQ.bet> X-Mailer: Apple Mail (2.3826.700.81) X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIxMDA1MiBTYWx0ZWRfX5EE/tpW23S5X YPoE4xA8ruL7mvpzjhcsn3xGvZBzdHV3MqK5o5WptgbDArq7MW7jkJDlsMsODZ37Lrfl+6wU8dS R4UgkUUj7CjkQJDAmbsEEcgdT7pAm7o+9jTFQ3g36DKUkWL2WbxSa99Fz2KVT6CtX/SSoOXJaFz 0DH/D5LWXb1AJK1ykjR0YsaacXMStgJbzHAEzJM8wVvO/jMtgqom8mhlbbSvlQa6UdZqiVbO5R+ GnJqtXH/bv2B2ZFF26gAWLCxXV2cFHFk8EmRdDErTGQV+4RufUbWDhNDV5h20Q3MY0quzggzk= X-Proofpoint-ORIG-GUID: rewys7FPU3L7_n-hlkrduWJLGIa-le0J X-Proofpoint-GUID: rewys7FPU3L7_n-hlkrduWJLGIa-le0J X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-21_01,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 clxscore=1011 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506270000 definitions=main-2508210052 X-JNJ: AAAAAAAB4VY9tu5XyYH+G9dE2pUeK1RPuFf0q4W6E4E/5CU9CQDI8FRuSh9NBATaY5Xr4rlNUxcApgT7YIhoNjh2Doy4GaLZiz1W2S1JeZP2Oq6NOlBkgerjMbXlxLJJEMXO3h2q6gBXMKqPw5DcH/IjGvsLS9CQADU6xEk9SmjSRqdPd7kFOVkstlNy2VOxIT7o2y2xq/trNoxDVQl7YW3tf1vBUbYGIEZ0AB2AJnKpmSSBjJyc2RCdlnIBpvdACfNjbQ4N7lUkTTdgf6igDKthYCpfdvs5ioHFKajsJL/uA5tmvCljDOqRjqtankUmCJAgZq/z8O+p7NsCdVZpQ6W0mzHggRpR4WuDmQZ69D24ByFw+aIRISVTczsQR6u689g7KFkWuY9O5p7UgmwcgrZSbY4OYYDcZAf9pgdOQu0YYfenPl9kgz2hi1eZyFq5JAM3uUAotzMKKSuqHBwzZYsoQLQLX4n1vxXqFpruwVA= X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:714, ipnet:57.103.88.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4c6vK34q1Gz3vxV --Apple-Mail=_934F1BC3-226F-4DA7-AD5A-B9B3614F975F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 21. Aug 2025, at 09:40, Bjoern A. Zeeb wrote: >=20 > On Thu, 21 Aug 2025, A FreeBSD User wrote: >=20 >> Am Tage des Herren Wed, 20 Aug 2025 22:48:38 GMT >> "Simon J. Gerraty" schrieb: >>=20 >>> The branch main has been updated by sjg: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db44cc1b479fefc8570611309c3f5a696= 6fb26e3b >>>=20 >>> commit b44cc1b479fefc8570611309c3f5a6966fb26e3b >>> Author: Simon J. Gerraty >>> AuthorDate: 2025-08-20 22:45:54 +0000 >>> Commit: Simon J. Gerraty >>> CommitDate: 2025-08-20 22:45:54 +0000 >>>=20 >>> loader: do not try to open directories with TFTP >>>=20 >>> Attempting to mount or even open / with some tftp servers >>> causes a several minute delay in boot. >>>=20 >>> Since opening a directory via TFTP does not make sense, we >>> avoid it. We don't know if using TFTP until after net_open() >>> has been called. >>>=20 >>> Add an is_tftp() accessor to avoid everyone having to include >>> all the net* headers. >>>=20 >>> Sponsored by: Juniper Networks, Inc. >>> Differential Revision: https://reviews.freebsd.org/D51447 >>> --- >>> stand/common/dev_net.c | 9 ++++++++- >>> stand/libsa/mount.c | 5 ++++- >>> stand/libsa/open.c | 8 ++++++++ >>> stand/libsa/stand.h | 3 +++ >>> 4 files changed, 23 insertions(+), 2 deletions(-) >>=20 >> Build of world/kernel fails with the error below: >>=20 >> [...] >>=20 >> --- all_subdir_stand/i386 --- >> --- all_subdir_stand/i386/gptzfsboot --- >> ld: error: undefined symbol: is_tftp >>>>> referenced by open.c >>>>> open.o:(open) in archive = /usr/obj/usr/src/amd64.amd64/stand/libsa32/libsa32.a >>>>> referenced by mount.c >>>>> mount.o:(mount) in archive >>>>> /usr/obj/usr/src/amd64.amd64/stand/libsa32/libsa32.a >> --- all_subdir_usr.sbin --- >> -function -Wno-enum-conversion -Wno-unused-local-typedef = -Wno-address-of-packed-member >> -Qunused-arguments -c /usr/src/contrib/tcpdump/print-ntp.c -o = print-ntp.pieo --- >> all_subdir_stand --- *** [gptzfsboot.out] Error code 1 >=20 > shot in the dark (haven't checked that LOADER_NET_SUPPORT would be = defined for these files): I do not think it is the approach you want to take there, because this = means you would need to build all those variants to build different = components=E2=80=A6 I would think of having weak is_tftp() implementation returning false = for case the dev_net.c is not built or move dev_net.c into libsa. I=E2=80=99= m not quite sure why dev_net.c is outside libsa anyhow;) rgds, toomas >=20 > diff --git stand/libsa/mount.c stand/libsa/mount.c > index c866dc9c7055..4b579c17a782 100644 > --- stand/libsa/mount.c > +++ stand/libsa/mount.c > @@ -109,8 +109,10 @@ mount(const char *dev, const char *path, int = flags __unused, void *data) > continue; > DEBUG_PRINTF(1,("%s: fs=3D%s path=3D%s\n", > __func__, fs->fs_name, path)); > +#ifdef LOADER_NET_SUPPORT > if (is_tftp()) > break; > +#endif > if (fs->fo_mount(dev, path, &data) !=3D 0) > continue; >=20 > diff --git stand/libsa/open.c stand/libsa/open.c > index 91848aca7dbe..0e44dc7b0942 100644 > --- stand/libsa/open.c > +++ stand/libsa/open.c > @@ -138,8 +138,10 @@ open(const char *fname, int mode) > struct fs_ops *fs; > struct open_file *f; > int fd, i, error, besterror; > +#ifdef LOADER_NET_SUPPORT > bool is_dir; > size_t n; > +#endif > const char *file; >=20 > TSENTER(); > @@ -184,14 +186,18 @@ open(const char *fname, int mode) >=20 > /* pass file name to the different filesystem open routines */ > besterror =3D ENOENT; > +#ifdef LOADER_NET_SUPPORT > n =3D strlen(file); > is_dir =3D (n > 0 && file[n - 1] =3D=3D '/'); > +#endif > for (i =3D 0; file_system[i] !=3D NULL; i++) { > fs =3D file_system[i]; > +#ifdef LOADER_NET_SUPPORT > if (is_dir && is_tftp()) { > error =3D EOPNOTSUPP; > goto err; > } > +#endif > error =3D (fs->fo_open)(file, f); > if (error =3D=3D 0) > goto ok; >=20 >=20 > --=20 > Bjoern A. Zeeb = r15:7 --Apple-Mail=_934F1BC3-226F-4DA7-AD5A-B9B3614F975F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 21. Aug 2025, at 09:40, Bjoern A. Zeeb = <bz@FreeBSD.org> wrote:

On Thu, 21 Aug 2025, A = FreeBSD User wrote:

Am Tage des Herren Wed, 20 Aug 2025 22:48:38 = GMT
"Simon J. Gerraty" <sjg@FreeBSD.org> = schrieb:

The branch main has been = updated by sjg:

URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db44cc1b479fefc8570611309c3f5a696= 6fb26e3b

commit = b44cc1b479fefc8570611309c3f5a6966fb26e3b
Author: =     Simon J. Gerraty = <sjg@FreeBSD.org>
AuthorDate: 2025-08-20 22:45:54 = +0000
Commit:     Simon J. Gerraty = <sjg@FreeBSD.org>
CommitDate: 2025-08-20 22:45:54 = +0000

   loader: do not try to open directories = with TFTP

   Attempting to mount or even open / = with some tftp servers
   causes a several minute = delay in boot.

   Since opening a directory via = TFTP does not make sense, we
   avoid it.  We = don't know if using TFTP until after net_open()
   has = been called.

   Add an is_tftp() accessor to avoid = everyone having to include
   all the net* = headers.

   Sponsored by:   Juniper = Networks, Inc.
   Differential Revision: =  https://reviews.freebsd.org/D51447
---
stand/common/dev_net.c = | 9 ++++++++-
stand/libsa/mount.c    | 5 = ++++-
stand/libsa/open.c     | 8 = ++++++++
stand/libsa/stand.h    | 3 +++
4 files = changed, 23 insertions(+), 2 deletions(-)

Build of = world/kernel fails with the error below:

[...]

--- = all_subdir_stand/i386 ---
--- all_subdir_stand/i386/gptzfsboot = ---
ld: error: undefined symbol: is_tftp
referenced by = open.c
          &nbs= p;  open.o:(open) in archive = /usr/obj/usr/src/amd64.amd64/stand/libsa32/libsa32.a
referenced by = mount.c
          &nb= sp;  mount.o:(mount) in = archive
/usr/obj/usr/src/amd64.amd64/stand/libsa32/libsa32.a
--- all_subdir_usr.sbin ---
-function = -Wno-enum-conversion -Wno-unused-local-typedef = -Wno-address-of-packed-member
-Qunused-arguments =      -c /usr/src/contrib/tcpdump/print-ntp.c -o = print-ntp.pieo ---
all_subdir_stand --- *** [gptzfsboot.out] Error = code 1

shot in = the dark (haven't checked that LOADER_NET_SUPPORT would be defined for = these files):


I do not = think it is the approach you want to take there, because this means you = would need to build all those variants to build different = components=E2=80=A6

I would think of having = weak is_tftp() implementation returning false for case the dev_net.c is not built or move dev_net.c into libsa. I=E2=80=99m not quite sure why = dev_net.c is outside libsa = anyhow;)

rgds,
toomas

diff = --git stand/libsa/mount.c stand/libsa/mount.c
index = c866dc9c7055..4b579c17a782 100644
--- = stand/libsa/mount.c
+++ = stand/libsa/mount.c
@@ = -109,8 +109,10 @@ mount(const char *dev, const char *path, int flags = __unused, void *data)
          &= nbsp;           &nb= sp;continue;
          &= nbsp;    DEBUG_PRINTF(1,("%s: fs=3D%s = path=3D%s\n",
          &= nbsp;           &nb= sp;__func__, fs->fs_name, path));
+#ifdef = LOADER_NET_SUPPORT
          &= nbsp;    if (is_tftp())
          &= nbsp;           &nb= sp;break;
+#endif
          &= nbsp;    if (fs->fo_mount(dev, path, &data) = !=3D 0)
          &= nbsp;           &nb= sp;continue;

diff --git = stand/libsa/open.c stand/libsa/open.c
index = 91848aca7dbe..0e44dc7b0942 100644
--- = stand/libsa/open.c
+++ = stand/libsa/open.c
@@ = -138,8 +138,10 @@ open(const char *fname, int mode)
       struct fs_ops = *fs;
       struct open_file = *f;
       int fd, i, error, = besterror;
+#ifdef = LOADER_NET_SUPPORT
       bool = is_dir;
       size_t = n;
+#endif
       const char = *file;

       TSENTER();@@ -184,14 +186,18 @@ = open(const char *fname, int mode)

       /* pass file name = to the different filesystem open routines */
       besterror =3D = ENOENT;
+#ifdef = LOADER_NET_SUPPORT
       n =3D = strlen(file);
       is_dir =3D (n = > 0 && file[n - 1] =3D=3D '/');
+#endif
       for (i =3D 0; = file_system[i] !=3D NULL; i++) {
          &= nbsp;    fs =3D file_system[i];
+#ifdef = LOADER_NET_SUPPORT
          &= nbsp;    if (is_dir && is_tftp()) = {
          &= nbsp;           &nb= sp;error =3D EOPNOTSUPP;
          &= nbsp;           &nb= sp;goto err;
          &= nbsp;    }
+#endif
          &= nbsp;    error =3D (fs->fo_open)(file, = f);
          &= nbsp;    if (error =3D=3D 0)
          &= nbsp;           &nb= sp;goto ok;


-- 
Bjoern A. Zeeb =             &n= bsp;           &nbs= p;            =             &n= bsp;  r15:7

= --Apple-Mail=_934F1BC3-226F-4DA7-AD5A-B9B3614F975F--