From patchwork Wed Sep 1 19:15:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sander Vanheule X-Patchwork-Id: 1523377 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=p1GlbUYE; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=jTESTxHQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H0DPW5gDKz9sPf for ; Thu, 2 Sep 2021 05:18:55 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=faM1QcRmkilxB7fK5r38qS5xTcgo1GK4fom/uMuF5sw=; b=p1GlbUYE8BTTdU NiLC1u5ocv673qpP7IfOJAhPtl+H2vkLdG2pkUQulFk/jBhPJ/wFL8e1DDxnHF5pxr5ZwhGVA/oTq kLbCXvczKArxrudzFtXOkKud4dSTgpP27QdPxliivEUGfTdg6GbyH8w9nfZhGynlFt1DoZulTSwQS rfcRru5sfBMORe4PQ7fdhq+2SHOb67QkHTrwH9Q7Z1rn9dH7F+I8BeaRktIQjpemUf5QLysRz+prb LmfY/lDj0hzf7FFjKeMfpGgCzCrHoElxNQ4knoY7Ie4I/38xu0Dn6cUwIk2Ia+/faYDU5+UDxvaVM o5TtS0DQpUukMqG953UQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLVif-0073nC-AQ; Wed, 01 Sep 2021 19:16:21 +0000 Received: from polaris.svanheule.net ([84.16.241.116]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLViX-0073kJ-KP for openwrt-devel@lists.openwrt.org; Wed, 01 Sep 2021 19:16:18 +0000 Received: from terra.local.svanheule.net (unknown [IPv6:2a02:a03f:eafe:c901:11d8:94c5:2734:3512]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id BCB482499A3; Wed, 1 Sep 2021 21:16:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1630523766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZQuuviEzStCQThoA9nj0rPPWo8xtJNNcqG3tKtWtZhI=; b=jTESTxHQ2r8/QxTSZ9vovsHSHpzqbdI4Ob2FoRMaYVMYkL3tUwFGhBgH3TZqEXg8nDSwhH nhUqsGnlgO+7tpRlaWmXLJdVXy/W7L9tIwOTWEWoiEwJDqTnZaL2FqDRFMDnIPRfY+PKu9 BItDXCcmbOY1ouKHj5Hpxhlxcwrr4TuiMhZNoLArOL0hMD88zf9E22TjaUHWgwhMoJOhMV HVqFLhhzy0lFJvrYTfA6/lZEBkMHJhqNccCNoxWiTbA42BRqQ/JFz6iCeZ1Tvt4ZhMxwTw pgyYo3H8aa5Oga7vVZ3o2B/0COTvp7kBMmvzguzWl087H198tTImz03kwj2teg== From: Sander Vanheule To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule Subject: [PATCH] firmware-utils: tplink-safeloader: use revision field Date: Wed, 1 Sep 2021 21:15:57 +0200 Message-Id: <20210901191557.340853-1-sander@svanheule.net> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210901_121613_912736_9DE191FD X-CRM114-Status: GOOD ( 11.44 ) X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The structured soft-version partition has a field which contains a (source) revision number. Factory images used to include this, but it was accidentaly removed during an earlier refactoring. Include the source revision number again in the generated soft-version partition. Additionaly, also show this revision number when printing image info. Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [84.16.241.116 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The structured soft-version partition has a field which contains a (source) revision number. Factory images used to include this, but it was accidentaly removed during an earlier refactoring. Include the source revision number again in the generated soft-version partition. Additionaly, also show this revision number when printing image info. Fixes: 1a211af2cb3b ("firmware-utils: tplink-safeloader: refactor meta-partition generation") Signed-off-by: Sander Vanheule --- This patch conflicts with my other tplink-safeloader patch [1] due to the PKG_RELEASE version bump. Depending on which would get merged first, the other patch needs to be rebased to bump from v10 to v11. [1] http://lists.infradead.org/pipermail/openwrt-devel/2021-August/036172.html Best, Sander tools/firmware-utils/Makefile | 2 +- tools/firmware-utils/src/tplink-safeloader.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 7b669ac0c661..ccc5e4609180 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME := firmware-utils -PKG_RELEASE := 9 +PKG_RELEASE := 10 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/kernel.mk diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index bd4d4b562ec7..2ec7dd1416c2 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -2681,6 +2681,7 @@ static struct image_partition_entry make_soft_version( .month = bcd(tm->tm_mon+1), .day = bcd(tm->tm_mday), + .rev = htonl(rev), .compat_level = htonl(info->soft_ver_compat_level) }; @@ -3368,6 +3369,7 @@ static int firmware_info(const char *input) printf("Version: %d.%d.%d\n", s->version_major, s->version_minor, s->version_patch); printf("Date: %02x%02x-%02x-%02x\n", s->year_hi, s->year_lo, s->month, s->day); + printf("Revision: %d\n", ntohl(s->rev)); } else { printf("Failed to parse data\n"); }