From nobody Thu Aug 21 04:12:17 2025 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 4c6qfp6LRMz65kJ8; Thu, 21 Aug 2025 04:12:50 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp6.goneo.de (smtp6.goneo.de [85.220.129.31]) (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 4c6qfp47jvz3YW0; Thu, 21 Aug 2025 04:12:50 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; none Received: from hub1.goneo.de (hub1.goneo.de [IPv6:2001:1640:5::8:52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp6.goneo.de (Postfix) with ESMTPS id C4356240F6F; Thu, 21 Aug 2025 06:12:47 +0200 (CEST) Received: from hub1.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub1.goneo.de (Postfix) with ESMTPS id EEA302400FE; Thu, 21 Aug 2025 06:12:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1755749566; 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=aIO3CY0D7zzLi6SJfWO84s0tYziFbKtuhBGbjWW2JtE=; b=YyPv/GqGb38bzYUqEfffHzi8gC1CSS9Q+G1f7V7+3SADx/YIEey0uta1yhluz1cY8wwH48 x7Mgt8/PIjmqzEfYYcwNAHiiti4ZaMXUZ/bGx2ZUT5DxIxcmwxlnv5RJYaRfHNyYvVLed+ fIUaCgpSCZvMREOPDPAK1frpGkkTj18fLnQC5LfHrAytsDhjsj+NHPps4gS7803FpmNeQ2 FS5Y8B0T0Vj+LMjtJJ/v7vmuYpCCw+qSx9BiSI3+JGUzkbVx1fPhh4VDNDtbj9Xdccj0pZ mx1yo0ZjA9JwSckkwFBf0KCb+AUL3xj402ghZ6MGVleMzFT8qLRhQ9suYxao4w== Received: from thor.sb211.local (dynamic-2a02-3100-1961-5702-0029-39ab-2988-8b92.310.pool.telefonica.de [IPv6:2a02:3100:1961:5702:29:39ab:2988:8b92]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub1.goneo.de (Postfix) with ESMTPSA id 94A14240159; Thu, 21 Aug 2025 06:12:45 +0200 (CEST) Date: Thu, 21 Aug 2025 06:12:17 +0200 From: A FreeBSD User To: "Simon J. Gerraty" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b44cc1b479fe - main - loader: do not try to open directories with TFTP Message-ID: <20250821060752.001c9599@thor.sb211.local> In-Reply-To: <202508202248.57KMmcTO016280@gitrepo.freebsd.org> References: <202508202248.57KMmcTO016280@gitrepo.freebsd.org> 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 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-UID: 644c95 X-Rspamd-UID: cb5e7c X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:25394, ipnet:85.220.128.0/17, country:DE] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4c6qfp47jvz3YW0 Am Tage des Herren Wed, 20 Aug 2025 22:48:38 GMT "Simon J. Gerraty" schrieb: > The branch main has been updated by sjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b44cc1b479fefc8570611309c3f5a6966fb26e3b > > 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 > > 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(-) > > diff --git a/stand/common/dev_net.c b/stand/common/dev_net.c > index 964fa514cac5..10389db27b99 100644 > --- a/stand/common/dev_net.c > +++ b/stand/common/dev_net.c > @@ -182,6 +182,7 @@ net_open(struct open_file *f, ...) > setenv("boot.netif.mtu", mtu, 1); > } > > + DEBUG_PRINTF(1,("%s: netproto=%d\n", __func__, netproto)); > } > netdev_opens++; > dev->d_opendata = &netdev_sock; > @@ -193,7 +194,7 @@ net_close(struct open_file *f) > { > struct devdesc *dev; > > - DEBUG_PRINTF(1,("%s: opens=%d\n", __func__, netdev_opens)); > + DEBUG_PRINTF(2,("%s: opens=%d\n", __func__, netdev_opens)); > > dev = f->f_devdata; > dev->d_opendata = NULL; > @@ -344,6 +345,12 @@ net_print(int verbose) > return (ret); > } > > +bool > +is_tftp(void) > +{ > + return (netproto == NET_TFTP); > +} > + > /* > * Parses the rootpath if present > * > diff --git a/stand/libsa/mount.c b/stand/libsa/mount.c > index 73bf6ab8118c..c866dc9c7055 100644 > --- a/stand/libsa/mount.c > +++ b/stand/libsa/mount.c > @@ -107,7 +107,10 @@ mount(const char *dev, const char *path, int flags __unused, void *data) > fs = file_system[i]; > if (fs->fo_mount == NULL) > continue; > - > + DEBUG_PRINTF(1,("%s: fs=%s path=%s\n", > + __func__, fs->fs_name, path)); > + if (is_tftp()) > + break; > if (fs->fo_mount(dev, path, &data) != 0) > continue; > > diff --git a/stand/libsa/open.c b/stand/libsa/open.c > index c97aa5977f9e..91848aca7dbe 100644 > --- a/stand/libsa/open.c > +++ b/stand/libsa/open.c > @@ -138,6 +138,8 @@ open(const char *fname, int mode) > struct fs_ops *fs; > struct open_file *f; > int fd, i, error, besterror; > + bool is_dir; > + size_t n; > const char *file; > > TSENTER(); > @@ -182,8 +184,14 @@ open(const char *fname, int mode) > > /* pass file name to the different filesystem open routines */ > besterror = ENOENT; > + n = strlen(file); > + is_dir = (n > 0 && file[n - 1] == '/'); > for (i = 0; file_system[i] != NULL; i++) { > fs = file_system[i]; > + if (is_dir && is_tftp()) { > + error = EOPNOTSUPP; > + goto err; > + } > error = (fs->fo_open)(file, f); > if (error == 0) > goto ok; > diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h > index c6a08be2f7e3..233d11ab3ecb 100644 > --- a/stand/libsa/stand.h > +++ b/stand/libsa/stand.h > @@ -507,6 +507,9 @@ extern void *reallocf(void *, size_t); > */ > caddr_t ptov(uintptr_t); > > +/* dev_net.c */ > +bool is_tftp(void); > + > /* features.c */ > typedef void (feature_iter_fn)(void *, const char *, const char *, bool); > > 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 >>> 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 -- A FreeBSD user