From nobody Thu Jan 13 09:49:02 2022 X-Original-To: dev-commits-src-branches@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 CEF8B12D1DCE; Thu, 13 Jan 2022 09:49:02 +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 4JZKQ64ZT8z4jCG; Thu, 13 Jan 2022 09:49:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642067342; 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=L0sh3lWOtTubwZEeMFEghEd48sIvP4TiB3iuzJxEoH4=; b=nnewKDDXOu6hUSkhMPX0vjudslLqdMRdv+ucJjg9u4KXmeJOst8XaGUgpAQpLQ68c04aer q+9WNZkWTQOuIIiLTSQnfbi3leWOa53G0oJDIkUbC55s/fuvvsSpGD9hmJoOQ3Tu53+gXc QDACgRMVyvm6y+jH8OKS8Cbv37nDKvEKPnkVDXEgIu9iWJFGvWj7zhiU3Ny7ETni56PRKb GfzL6i5IupCuoRWzg0+1Lhx8gQV8eyzOzL5yKSzb7GlRepjdiaAdni69k/8InfpUMhnDul Kx7Z/5qnK+XxR1oOyb9f3dHq2rrfsymYQK+ag4ZpjLVcQfeTevEk4eRToIFJmw== 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 599161E3C6; Thu, 13 Jan 2022 09:49:02 +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 20D9n2Mj095848; Thu, 13 Jan 2022 09:49:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20D9n2fH095847; Thu, 13 Jan 2022 09:49:02 GMT (envelope-from git) Date: Thu, 13 Jan 2022 09:49:02 GMT Message-Id: <202201130949.20D9n2fH095847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: e3ef89ba9673 - stable/13 - loader: tftp: Don't let tftp timeout List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: e3ef89ba96730180f55b9fc6af4c29e1482b9ac6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642067342; 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=L0sh3lWOtTubwZEeMFEghEd48sIvP4TiB3iuzJxEoH4=; b=NtHLF1ufae+hgzMoAHslZiSRrhM3SUD0m/VqlrTcCQ4inD8zCtYuCfdipDNlQLmzTlcR2s L8/2qWlxSN7rNHYFJokmrTXsPrPxQtmEnuqdwj/ovScbx9/7GMHFa50VneVf1Lztm1V/YB +7BlZfSEwLf9UtPQdMrCkSYPcOLnoqU4uLq1v+PVrrVc8T2S06CP1Hd3GPoqMkh8uvHhAy Hwih6qMvBqNZp/gXVLoIVIQS//dJqQlD2nOmvUKvjqFOl7uvyy/nTtmJf9bHmpXADXH6lO JrxabKatp9NadROxOzf7WNqRM4DO2FuCrMXu7qCmiVdw7hSO9xygSwVLuUO3rA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642067342; a=rsa-sha256; cv=none; b=n8/g8pjeVrJr5USBH8rpe55XvRZ9pCGyM1gUnnPtNDozF/dL1YaXfl4Gw0Aj+76Aaj2Vcz 0wwqMp8v4xC8SL2QIqHbCj8VTg47Tazi5uGxjVLe7uCKGZJNwK4YtIQ9BULv7BIOenEJVj m9mBQZM+MaeGEAzd4l4MnkgVkNCof5uPWSR1S2WcLYzhIpHhsJyZBYYOKD5JXANwUIAMAV DSInqfiAC4Ei7yl7xZN5u/RvQA0PCncuJtT5SnGc1klwmAdTZPwQbuyIIFwQ7ldoqAVMJw M8KIC6p1Qw/taQXZzUoMBxKDjsd2aw2mYp00uW5cZBWH7z/sAFvNJ9vFHLaI7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=e3ef89ba96730180f55b9fc6af4c29e1482b9ac6 commit e3ef89ba96730180f55b9fc6af4c29e1482b9ac6 Author: Emmanuel Vadot AuthorDate: 2021-12-13 09:35:23 +0000 Commit: Emmanuel Vadot CommitDate: 2022-01-13 07:55:51 +0000 loader: tftp: Don't let tftp timeout When we load a kernel or module we open/close it a few times. Since we're using the same port number each time and that we requested the same file the ACK that we send are valid on the server side and the server send us the file multiple times. This makes tftp loading time very inconsistant due to the UDP "flood" that we have to process. Reviewed by: imp, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33407 (cherry picked from commit 4f36ed513cc8fc3fe780b23ecda8cb1fdc6edf7d) --- stand/libsa/tftp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c index 37f8b64f99aa..a63ca8d16d4d 100644 --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -113,6 +113,8 @@ struct tftp_handle { unsigned long tftp_tsize; void *pkt; struct tftphdr *tftp_hdr; + char *tftp_cache; + bool lastacksent; }; struct tftprecv_extra { @@ -377,6 +379,7 @@ tftp_makereq(struct tftp_handle *h) if (res < h->tftp_blksize) { h->islastblock = 1; /* very short file */ tftp_sendack(h, h->currblock); + h->lastacksent = true; } return (0); } @@ -591,7 +594,8 @@ tftp_close(struct open_file *f) struct tftp_handle *tftpfile; tftpfile = f->f_fsdata; - /* let it time out ... */ + if (tftpfile->lastacksent == false) + tftp_senderr(tftpfile, 0, "No error: file closed"); if (tftpfile) { free(tftpfile->path);