From nobody Thu Dec 30 15:31:01 2021 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 C327F191CAAA; Thu, 30 Dec 2021 15:31:01 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JPsg93rh9z3r9C; Thu, 30 Dec 2021 15:31:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 647581AC44; Thu, 30 Dec 2021 15:31:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BUFV1TZ005753; Thu, 30 Dec 2021 15:31:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BUFV11X005752; Thu, 30 Dec 2021 15:31:01 GMT (envelope-from git) Date: Thu, 30 Dec 2021 15:31:01 GMT Message-Id: <202112301531.1BUFV11X005752@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: dfc9c1d4937d - main - loader: tftp: Copy the first block into the cache 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfc9c1d4937d0e2eab2910665069faba814bca1e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640878261; 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=zzZqHu49QwI+6stHvNYXgW/kiL5/xVgqiuHBmqXRQzs=; b=u9KD0CSTj2XpMnTs/fh5iuIBALyTisDADjJ3AZ31/7AF6VQmD38AN67fH6EciIfqybzRvZ Vm7EN9XWiMh5vEceZ8lzIE4/SaWhgfWJEN2HoE3wGqnx6Y5IrXiX5WHtISjgeGpv3En5uK nsZe7SSkjMlvoHa56kVHNV+Xk3rdpOSgxxvE78SnNuLQlIwzpub6kwN+xP0397AtaAUSTc juFe1OJUg1Q36VwUwJPUMttx89o8V+W25XGr6riKwbsd0aNzCpLi8m4nKYOfVCumkub18N zQwR2BYvUZTfyBCS7E5l8ZHvIsK/23qHa187zXxDjAkCGXbUIBekiPeq1KFwOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640878261; a=rsa-sha256; cv=none; b=EYh8310rqIGLN3gjfpRbiXnZ26wVRl1tTruy6/Q7vwcgiw385g9bS+6mg5wLoUOdPhr9V1 HnTxtN7gn4B414BUwqx24o0EsMojgyesDSnykm9/SOj2RIkgL/3DDgMGzoQLA/Z2Ma5I4h urBuME23mlAnZTH3RgnBE4poQe5dzD9WeEekw5DUWt1NPzbjwIFP5M7OZthJ/g9NVnURL0 XWIDPkYEzFJ5a7VIL1N53P0RKdCuQEAwQ0aacY4JT3juQklUjbxvE7mGz9CmCih5uYnBY1 HjWovgw9ak6FmKYMnQCyd/u+2P6Ej+XXoDRN0BpoAk2Pq9uHORoPLpLcVMclLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=dfc9c1d4937d0e2eab2910665069faba814bca1e commit dfc9c1d4937d0e2eab2910665069faba814bca1e Author: Emmanuel Vadot AuthorDate: 2021-12-30 08:47:06 +0000 Commit: Emmanuel Vadot CommitDate: 2021-12-30 15:30:13 +0000 loader: tftp: Copy the first block into the cache tftp_open reads the first block so copy it in the cached data. If we have more than one block (i.e. we called tftp_read before tftp_preload) simply just reset the transfer. Reported by: mmel Reviewed by: mmel, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33697 --- stand/libsa/tftp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c index 9d1c70236925..c520a9e3b3b1 100644 --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -680,6 +680,13 @@ tftp_preload(struct open_file *f) start = getsecs(); printf("Preloading %s ", tftpfile->path); #endif + if (tftpfile->currblock == 1) + bcopy(tftpfile->tftp_hdr->th_data, + cache, + tftpfile->validsize); + else + tftpfile->currblock = 0; + while (tftpfile->islastblock == 0) { twiddle(32); rc = tftp_getnextblock(tftpfile);