From patchwork Tue Jul 30 02:12:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Safonov via B4 Relay X-Patchwork-Id: 815501 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF4A91773D; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722305609; cv=none; b=dRDNJScNW70vmvLQkww0qaCgXI8AyQDel3mqUECFGBoW2DwuL9kVgqgerFdW9nHEdmrGLKKg8kWbZ5UG7q+q0h//ZTQb7NPEewicmaNT0/oGeubctuL/nkUbD5lU+ZK8zJCsgKNfb4s7HNUWOIeXHsc+qPooC9irhR/GN4mNN50= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722305609; c=relaxed/simple; bh=xKJ531oeNGYJ3rhSQThy26hzbdbPUPpEuw0uOAhhf54=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DFF/T8VmcSw10tq1jB3lasLow2QHmJC3OsWEPddTeirB9xwXYuxtz5fmn//z50IVcUG+/D0QSfTCUL52s7m+JJvNMBtq1L3gV+pRuKACZkhNio0L4/6AsHii418bQdx20gPpHCh6ABRgkba7mLGHlHcBC6SxtEavDKWlPMiTolM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gFEd7RV9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gFEd7RV9" Received: by smtp.kernel.org (Postfix) with ESMTPS id 862E7C4AF0C; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722305609; bh=xKJ531oeNGYJ3rhSQThy26hzbdbPUPpEuw0uOAhhf54=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=gFEd7RV9hyUy/cGSO+oPHaQJr8DIDJLQLp6HbUHuHYh+7Yr+DE8u3BOM0IdRpPIb1 mWefD11xppDBWbkJMdPn/J98sqoprR5R59mWWKhhcYL7mIaYymyARg0/tofJTwOB1P 3ow1L3oJKasUIMDmAKz8PxjtICqtfad5AYKaEyvnhaOcJafy+gz5uQrOpfnAbf3WxH RimBNGzBDGITQogbRvF35SzD34IqBdz8EU+7FDoeFBLQcnQf7soMoeVFvwVhcd2IDO /8GfAxQKO+GpJU6wIOe20bBKPisdbKMnLqiYj26QLyV11nGHuWa6WayEvxGl8gcft7 ecVfpGVemjpuQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76595C3DA4A; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) From: Dmitry Safonov via B4 Relay Date: Tue, 30 Jul 2024 03:12:16 +0100 Subject: [PATCH net-next 2/7] selftests/net: Provide test_snprintf() helper Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240730-tcp-ao-selftests-upd-6-12-v1-2-ffd4bf15d638@gmail.com> References: <20240730-tcp-ao-selftests-upd-6-12-v1-0-ffd4bf15d638@gmail.com> In-Reply-To: <20240730-tcp-ao-selftests-upd-6-12-v1-0-ffd4bf15d638@gmail.com> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Mohammad Nassiri , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com> X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722305607; l=1997; i=0x7f454c46@gmail.com; s=20240410; h=from:subject:message-id; bh=Hn2Bs9Fc12/AgT2T+RfB5ex9Lh+DmQaxL5WEBCBy03c=; b=vzbfnONCkUpmAXmtf052TLVJ0Gl9J9VN6abOlydRPRQDr1Itxrv4mqS6HUDMLSqZy3XOPh7jw kfNFciSa+TpDSZqlQYQsL0Fb436BuXK7b49538rgEMu3l5OV2WTCf7h X-Developer-Key: i=0x7f454c46@gmail.com; a=ed25519; pk=cFSWovqtkx0HrT5O9jFCEC/Cef4DY8a2FPeqP4THeZQ= X-Endpoint-Received: by B4 Relay for 0x7f454c46@gmail.com/20240410 with auth_id=152 X-Original-From: Dmitry Safonov <0x7f454c46@gmail.com> Reply-To: 0x7f454c46@gmail.com From: Dmitry Safonov <0x7f454c46@gmail.com> Re-invented std::stringstream :-) No need for buffer array - malloc() it. It's going to be helpful of path concat printings. Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com> --- tools/testing/selftests/net/tcp_ao/lib/aolib.h | 56 ++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/tcp_ao/lib/aolib.h b/tools/testing/selftests/net/tcp_ao/lib/aolib.h index fbc7f6111815..fdf44d176e0b 100644 --- a/tools/testing/selftests/net/tcp_ao/lib/aolib.h +++ b/tools/testing/selftests/net/tcp_ao/lib/aolib.h @@ -37,17 +37,59 @@ extern void __test_xfail(const char *buf); extern void __test_error(const char *buf); extern void __test_skip(const char *buf); +static inline char *test_snprintf(const char *fmt, va_list vargs) +{ + char *ret = NULL; + size_t size = 0; + va_list tmp; + int n = 0; + + va_copy(tmp, vargs); + n = vsnprintf(ret, size, fmt, tmp); + if (n < 0) + return NULL; + + size = (size_t) n + 1; + ret = malloc(size); + if (ret == NULL) + return NULL; + + n = vsnprintf(ret, size, fmt, vargs); + if (n < 0 || n > size - 1) { + free(ret); + return NULL; + } + return ret; +} + +__attribute__((__format__(__printf__, 1, 2))) +static inline char *test_sprintf(const char *fmt, ...) +{ + va_list vargs; + char *ret; + + va_start(vargs, fmt); + ret = test_snprintf(fmt, vargs); + va_end(vargs); + + return ret; +} + __attribute__((__format__(__printf__, 2, 3))) static inline void __test_print(void (*fn)(const char *), const char *fmt, ...) { -#define TEST_MSG_BUFFER_SIZE 4096 - char buf[TEST_MSG_BUFFER_SIZE]; - va_list arg; + va_list vargs; + char *msg; - va_start(arg, fmt); - vsnprintf(buf, sizeof(buf), fmt, arg); - va_end(arg); - fn(buf); + va_start(vargs, fmt); + msg = test_snprintf(fmt, vargs); + va_end(vargs); + + if (!msg) + return; + + fn(msg); + free(msg); } #define test_print(fmt, ...) \ From patchwork Tue Jul 30 02:12:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Safonov via B4 Relay X-Patchwork-Id: 815500 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE3C429D1C; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722305610; cv=none; b=uYHKaaMppFx1plK8lhXxhgrJnC1D/E6elZdMZkImpqWzj3pn0/tOb2ILISQv2KZy9UISBwtwfulrFZFieu++O+YcftQGfolL+qpSkZ/nX3t1UA3fNlDyzJyKsHiMd9ZxS4DOhhLpegKNwuJAWBwKoH7Ht0fermPxfeHPyg0juak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722305610; c=relaxed/simple; bh=gdo0igheQhF6s/jKqqf8T/+Oo8XxPTB3fpPf+BCe4so=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W8MZaC08xrHfZ6ynVIAsSWwOv2BjasRNcjeo+0AvhHGpwbwtfDA04VC0NqOl6PYT1Iw22d3GpVGSs6hAbZwQPQBIsJhSJ8I79L7CfGkgDsPvc+jXnlfyROLeoGLclwNz7WT2qD7Xnz2vP0ALOhoAOU3FYTErcht3UpQx53L+Co4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Qm+0ORO/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qm+0ORO/" Received: by smtp.kernel.org (Postfix) with ESMTPS id 95352C4AF0F; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722305609; bh=gdo0igheQhF6s/jKqqf8T/+Oo8XxPTB3fpPf+BCe4so=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Qm+0ORO/7gIElJjdJUS2he6hdPMplyrl3v9Ck70nXeTX46VLErjwT/j1eFUDITqQF qUKMPaAeGY/D+YRrcUBkDEOFBxqwDUh16r3hL6OcWdqi0yN48tGdiPwLkPfRkm4LNW Ob8RWkEdqP/zsX50EDKoJEml5WgTr65rVhr68QDjUI5AwFiZUzBbGkEG2myVArNuIU /WCbTukVv6WrgzIbgsCUO70k2g+V6WmZGBkpNE8wD+573mSz0bVRTQN/5S155chNO6 fdTZt5m8ePxYQUYeadEbz+GuBpZjv7F0/sENjHqELpP6s5dWNVelWVdTFIbh9NpL8j koIMC3SnubRQg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86606C3DA61; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) From: Dmitry Safonov via B4 Relay Date: Tue, 30 Jul 2024 03:12:17 +0100 Subject: [PATCH net-next 3/7] selftests/net: Be consistent in kconfig checks Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240730-tcp-ao-selftests-upd-6-12-v1-3-ffd4bf15d638@gmail.com> References: <20240730-tcp-ao-selftests-upd-6-12-v1-0-ffd4bf15d638@gmail.com> In-Reply-To: <20240730-tcp-ao-selftests-upd-6-12-v1-0-ffd4bf15d638@gmail.com> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Mohammad Nassiri , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com> X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722305607; l=2700; i=0x7f454c46@gmail.com; s=20240410; h=from:subject:message-id; bh=PdEStG299EXQfXQVBhomcx2f3Galb07Vq+9A5L4s+Lw=; b=uMBROFsSPN4MGu5IQV+mWnWwnDaL/ftb+UbVj6bG4WudU2Aen4e2F32hiz8AkRimC7Tto53Vt JD4v8GKGqKCDuf1FugHzWf7BCMWKiXL3uCyyzteQWb/iXt2DBnYntNj X-Developer-Key: i=0x7f454c46@gmail.com; a=ed25519; pk=cFSWovqtkx0HrT5O9jFCEC/Cef4DY8a2FPeqP4THeZQ= X-Endpoint-Received: by B4 Relay for 0x7f454c46@gmail.com/20240410 with auth_id=152 X-Original-From: Dmitry Safonov <0x7f454c46@gmail.com> Reply-To: 0x7f454c46@gmail.com From: Dmitry Safonov <0x7f454c46@gmail.com> Most of the functions in tcp-ao lib/ return negative errno or -1 in case of a failure. That creates inconsistencies in lib/kconfig, which saves what was the error code. As well as the uninitialized kconfig value is -1, which also may be the result of a check. Define KCONFIG_UNKNOWN and save negative return code, rather than libc-style errno. Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com> --- tools/testing/selftests/net/tcp_ao/lib/kconfig.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/tcp_ao/lib/kconfig.c b/tools/testing/selftests/net/tcp_ao/lib/kconfig.c index f279ffc3843b..3bf4a7e4b3c9 100644 --- a/tools/testing/selftests/net/tcp_ao/lib/kconfig.c +++ b/tools/testing/selftests/net/tcp_ao/lib/kconfig.c @@ -6,7 +6,7 @@ #include "aolib.h" struct kconfig_t { - int _errno; /* the returned error if not supported */ + int _error; /* negative errno if not supported */ int (*check_kconfig)(int *error); }; @@ -62,7 +62,7 @@ static int has_tcp_ao(int *err) memcpy(&tmp.addr, &addr, sizeof(addr)); *err = 0; if (setsockopt(sk, IPPROTO_TCP, TCP_AO_ADD_KEY, &tmp, sizeof(tmp)) < 0) { - *err = errno; + *err = -errno; if (errno != ENOPROTOOPT) ret = -errno; } @@ -87,7 +87,7 @@ static int has_tcp_md5(int *err) */ *err = 0; if (test_set_md5(sk, addr_any, 0, -1, DEFAULT_TEST_PASSWORD)) { - *err = errno; + *err = -errno; if (errno != ENOPROTOOPT && errno == ENOMEM) { test_print("setsockopt(TCP_MD5SIG_EXT): %m"); ret = -errno; @@ -116,13 +116,14 @@ static int has_vrfs(int *err) return ret; } +#define KCONFIG_UNKNOWN 1 static pthread_mutex_t kconfig_lock = PTHREAD_MUTEX_INITIALIZER; static struct kconfig_t kconfig[__KCONFIG_LAST__] = { - { -1, has_net_ns }, - { -1, has_veth }, - { -1, has_tcp_ao }, - { -1, has_tcp_md5 }, - { -1, has_vrfs }, + { KCONFIG_UNKNOWN, has_net_ns }, + { KCONFIG_UNKNOWN, has_veth }, + { KCONFIG_UNKNOWN, has_tcp_ao }, + { KCONFIG_UNKNOWN, has_tcp_md5 }, + { KCONFIG_UNKNOWN, has_vrfs }, }; const char *tests_skip_reason[__KCONFIG_LAST__] = { @@ -138,11 +139,11 @@ bool kernel_config_has(enum test_needs_kconfig k) bool ret; pthread_mutex_lock(&kconfig_lock); - if (kconfig[k]._errno == -1) { - if (kconfig[k].check_kconfig(&kconfig[k]._errno)) + if (kconfig[k]._error == KCONFIG_UNKNOWN) { + if (kconfig[k].check_kconfig(&kconfig[k]._error)) test_error("Failed to initialize kconfig %u", k); } - ret = kconfig[k]._errno == 0; + ret = kconfig[k]._error == 0; pthread_mutex_unlock(&kconfig_lock); return ret; } From patchwork Tue Jul 30 02:12:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Safonov via B4 Relay X-Patchwork-Id: 815499 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A616823DD; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722305610; cv=none; b=Q9tRv0dP6tpfqpQRnDvCcKn7+vr0ulwjYZIFdwCabezK5nOPr0Jyp3sAqlr8wDg0xSqf5iGgF6n+jUVjlZo8LossRBE8ckTV3VG2tf6mNwyv5rgTsvNI3R6TGOQbUAXTRkb4VznDFmD0XUqzLZX/MLuF5CJgWD9EO6O1PBuLMTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722305610; c=relaxed/simple; bh=qaIxzhJ+auD33h9udz/QNyEoZ851JZn2dE3kSu2mnnY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cAONozQRrtRA9yP5rEkSWlLTVMXFDUfISZBfhKBSpNRH7ivYwTo8THs9ymvy85/y8xAg80JbxBbFAV/6IzbVM8QINGNdD1SCb0gj8C+IJsOSOMf6ozpSnEgMgfHEBj1H6wgeEkfhLJ5XPDxAzEeoo6NlUU/UYHC+zbfvXqMJw2s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Md+JEMLI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Md+JEMLI" Received: by smtp.kernel.org (Postfix) with ESMTPS id B715CC4AF15; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722305609; bh=qaIxzhJ+auD33h9udz/QNyEoZ851JZn2dE3kSu2mnnY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Md+JEMLIvWiMB18FsRETGETGiiMbIGv3uk9d6k22FJTTc2wEkKW+BEFfVsJnhDd3E NHbHvDyqQmr8q1/OoHO3Rzfh96VEl3uoMakUviYNeO8irgSvUW2pAgXNOJIUBUT3/C 59UY05sCcc5+f2wZSZzyy0T7NrRYCEIMA61MRykVFReUm4YhIMXGEO0yJJ54sy7igP tFxdCBH4JC/M50nKsfbdI2ORfkhXpcWLr//Kzw4Oa75bEnOb27dBDgsFb5++1E9Zqo kIZWpwNCt7OxEYZiemZjnYsI3/7zlrDwZV1J4GfJQqI4nRor9P6ToLZQlcYBYgk4jO mh5xoPF6RzKWQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA4F7C3DA4A; Tue, 30 Jul 2024 02:13:29 +0000 (UTC) From: Dmitry Safonov via B4 Relay Date: Tue, 30 Jul 2024 03:12:19 +0100 Subject: [PATCH net-next 5/7] selftests/tcp_ao: Fix printing format for uint64_t Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240730-tcp-ao-selftests-upd-6-12-v1-5-ffd4bf15d638@gmail.com> References: <20240730-tcp-ao-selftests-upd-6-12-v1-0-ffd4bf15d638@gmail.com> In-Reply-To: <20240730-tcp-ao-selftests-upd-6-12-v1-0-ffd4bf15d638@gmail.com> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Mohammad Nassiri , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com> X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722305607; l=8808; i=0x7f454c46@gmail.com; s=20240410; h=from:subject:message-id; bh=YPEKLzEz54yx6GuwPZWnAYt7STgja9OwIZZWpccDw5M=; b=1SNQ3u7EsNeOLx4VJhF00RB78owa/qkV02FafG3yCGq9ElxEYmM04VXYaqcez+KAWlSGC/UvW P6AOD6MSvKxDqzhxReQYF9GVTNs0/MmL+pHlwIB0Thr5ooPQevzpQFp X-Developer-Key: i=0x7f454c46@gmail.com; a=ed25519; pk=cFSWovqtkx0HrT5O9jFCEC/Cef4DY8a2FPeqP4THeZQ= X-Endpoint-Received: by B4 Relay for 0x7f454c46@gmail.com/20240410 with auth_id=152 X-Original-From: Dmitry Safonov <0x7f454c46@gmail.com> Reply-To: 0x7f454c46@gmail.com From: Mohammad Nassiri It's not safe to use '%zu' specifier for printing uint64_t on 32-bit systems. For uint64_t, we should use the 'PRIu64' macro from the inttypes.h library. This ensures that the uint64_t is printed correctly from the selftests regardless of the system architecture. Signed-off-by: Mohammad Nassiri [Added missing spaces in fail/ok messages and uint64_t cast in setsockopt-closed, as otherwise it was giving warnings on 64bit. And carried it to netdev ml] Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com> --- tools/testing/selftests/net/tcp_ao/connect-deny.c | 4 ++-- tools/testing/selftests/net/tcp_ao/connect.c | 4 ++-- tools/testing/selftests/net/tcp_ao/restore.c | 8 ++++---- tools/testing/selftests/net/tcp_ao/self-connect.c | 4 ++-- tools/testing/selftests/net/tcp_ao/seq-ext.c | 12 ++++++------ tools/testing/selftests/net/tcp_ao/setsockopt-closed.c | 4 ++-- tools/testing/selftests/net/tcp_ao/unsigned-md5.c | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/net/tcp_ao/connect-deny.c b/tools/testing/selftests/net/tcp_ao/connect-deny.c index 185a2f6e5ff3..5691f3d00603 100644 --- a/tools/testing/selftests/net/tcp_ao/connect-deny.c +++ b/tools/testing/selftests/net/tcp_ao/connect-deny.c @@ -84,10 +84,10 @@ static void try_accept(const char *tst_name, unsigned int port, const char *pwd, after_cnt = netstat_get_one(cnt_name, NULL); if (after_cnt <= before_cnt) { - test_fail("%s: %s counter did not increase: %zu <= %zu", + test_fail("%s: %s counter did not increase: %" PRIu64 " <= %" PRIu64, tst_name, cnt_name, after_cnt, before_cnt); } else { - test_ok("%s: counter %s increased %zu => %zu", + test_ok("%s: counter %s increased %" PRIu64 " => %" PRIu64, tst_name, cnt_name, before_cnt, after_cnt); } diff --git a/tools/testing/selftests/net/tcp_ao/connect.c b/tools/testing/selftests/net/tcp_ao/connect.c index 81653b47f303..9eecc4a1072e 100644 --- a/tools/testing/selftests/net/tcp_ao/connect.c +++ b/tools/testing/selftests/net/tcp_ao/connect.c @@ -67,14 +67,14 @@ static void *client_fn(void *arg) netstat_free(ns_after); if (nr_packets > (after_aogood - before_aogood)) { - test_fail("TCPAOGood counter mismatch: %zu > (%zu - %zu)", + test_fail("TCPAOGood counter mismatch: %zu > (%" PRIu64 " - %" PRIu64 ")", nr_packets, after_aogood, before_aogood); return NULL; } if (test_tcp_ao_counters_cmp("connect", &ao1, &ao2, TEST_CNT_GOOD)) return NULL; - test_ok("connect TCPAOGood %" PRIu64 "/%" PRIu64 "/%" PRIu64 " => %" PRIu64 "/%" PRIu64 "/%" PRIu64 ", sent %" PRIu64, + test_ok("connect TCPAOGood %" PRIu64 "/%" PRIu64 "/%" PRIu64 " => %" PRIu64 "/%" PRIu64 "/%" PRIu64 ", sent %zu", before_aogood, ao1.ao_info_pkt_good, ao1.key_cnts[0].pkt_good, after_aogood, ao2.ao_info_pkt_good, diff --git a/tools/testing/selftests/net/tcp_ao/restore.c b/tools/testing/selftests/net/tcp_ao/restore.c index 8fdc808df325..7b91d7fde2bc 100644 --- a/tools/testing/selftests/net/tcp_ao/restore.c +++ b/tools/testing/selftests/net/tcp_ao/restore.c @@ -71,10 +71,10 @@ static void try_server_run(const char *tst_name, unsigned int port, test_tcp_ao_counters_cmp(tst_name, &ao1, &ao2, cnt_expected); if (after_cnt <= before_cnt) { - test_fail("%s: %s counter did not increase: %zu <= %zu", + test_fail("%s: %s counter did not increase: %" PRIu64 " <= %" PRIu64, tst_name, cnt_name, after_cnt, before_cnt); } else { - test_ok("%s: counter %s increased %zu => %zu", + test_ok("%s: counter %s increased %" PRIu64 " => %" PRIu64, tst_name, cnt_name, before_cnt, after_cnt); } @@ -183,10 +183,10 @@ static void test_sk_restore(const char *tst_name, unsigned int server_port, test_tcp_ao_counters_cmp(tst_name, &ao1, &ao2, cnt_expected); if (after_cnt <= before_cnt) { - test_fail("%s: %s counter did not increase: %zu <= %zu", + test_fail("%s: %s counter did not increase: %" PRIu64 " <= %" PRIu64, tst_name, cnt_name, after_cnt, before_cnt); } else { - test_ok("%s: counter %s increased %zu => %zu", + test_ok("%s: counter %s increased %" PRIu64 " => %" PRIu64, tst_name, cnt_name, before_cnt, after_cnt); } synchronize_threads(); /* 3: verified => closed */ diff --git a/tools/testing/selftests/net/tcp_ao/self-connect.c b/tools/testing/selftests/net/tcp_ao/self-connect.c index a5698b0a3718..e56931d38e06 100644 --- a/tools/testing/selftests/net/tcp_ao/self-connect.c +++ b/tools/testing/selftests/net/tcp_ao/self-connect.c @@ -87,7 +87,7 @@ static void tcp_self_connect(const char *tst, unsigned int port, netstat_free(ns_after); if (after_aogood <= before_aogood) { - test_fail("%s: TCPAOGood counter mismatch: %zu <= %zu", + test_fail("%s: TCPAOGood counter mismatch: %" PRIu64 " <= %" PRIu64, tst, after_aogood, before_aogood); close(sk); return; @@ -148,7 +148,7 @@ static void tcp_self_connect(const char *tst, unsigned int port, netstat_free(ns_after); close(sk); if (after_aogood <= before_aogood) { - test_fail("%s: TCPAOGood counter mismatch: %zu <= %zu", + test_fail("%s: TCPAOGood counter mismatch: %" PRIu64 " <= %" PRIu64, tst, after_aogood, before_aogood); return; } diff --git a/tools/testing/selftests/net/tcp_ao/seq-ext.c b/tools/testing/selftests/net/tcp_ao/seq-ext.c index ad4e77d6823e..9c7dde7fd776 100644 --- a/tools/testing/selftests/net/tcp_ao/seq-ext.c +++ b/tools/testing/selftests/net/tcp_ao/seq-ext.c @@ -134,15 +134,15 @@ static void *server_fn(void *arg) test_tcp_ao_counters_cmp(NULL, &ao1, &ao2, TEST_CNT_GOOD); if (after_good <= before_good) { - test_fail("TCPAOGood counter did not increase: %zu <= %zu", + test_fail("TCPAOGood counter did not increase: %" PRIu64 " <= %" PRIu64, after_good, before_good); } else { - test_ok("TCPAOGood counter increased %zu => %zu", + test_ok("TCPAOGood counter increased %" PRIu64 " => %" PRIu64, before_good, after_good); } after_bad = netstat_get_one("TCPAOBad", NULL); if (after_bad) - test_fail("TCPAOBad counter is non-zero: %zu", after_bad); + test_fail("TCPAOBad counter is non-zero: %" PRIu64, after_bad); else test_ok("TCPAOBad counter didn't increase"); test_enable_repair(sk); @@ -219,15 +219,15 @@ static void *client_fn(void *arg) test_tcp_ao_counters_cmp(NULL, &ao1, &ao2, TEST_CNT_GOOD); if (after_good <= before_good) { - test_fail("TCPAOGood counter did not increase: %zu <= %zu", + test_fail("TCPAOGood counter did not increase: %" PRIu64 " <= %" PRIu64, after_good, before_good); } else { - test_ok("TCPAOGood counter increased %zu => %zu", + test_ok("TCPAOGood counter increased %" PRIu64 " => %" PRIu64, before_good, after_good); } after_bad = netstat_get_one("TCPAOBad", NULL); if (after_bad) - test_fail("TCPAOBad counter is non-zero: %zu", after_bad); + test_fail("TCPAOBad counter is non-zero: %" PRIu64, after_bad); else test_ok("TCPAOBad counter didn't increase"); diff --git a/tools/testing/selftests/net/tcp_ao/setsockopt-closed.c b/tools/testing/selftests/net/tcp_ao/setsockopt-closed.c index 517930f9721b..5eee826c37aa 100644 --- a/tools/testing/selftests/net/tcp_ao/setsockopt-closed.c +++ b/tools/testing/selftests/net/tcp_ao/setsockopt-closed.c @@ -30,8 +30,8 @@ static void test_vefify_ao_info(int sk, struct tcp_ao_info_opt *info, #define __cmp_ao(member) \ do { \ if (info->member != tmp.member) { \ - test_fail("%s: getsockopt(): " __stringify(member) " %zu != %zu", \ - tst, (size_t)info->member, (size_t)tmp.member); \ + test_fail("%s: getsockopt(): " __stringify(member) " %" PRIu64 " != %" PRIu64, \ + tst, (uint64_t)info->member, (uint64_t)tmp.member); \ return; \ } \ } while(0) diff --git a/tools/testing/selftests/net/tcp_ao/unsigned-md5.c b/tools/testing/selftests/net/tcp_ao/unsigned-md5.c index 6b59a652159f..ec2848036341 100644 --- a/tools/testing/selftests/net/tcp_ao/unsigned-md5.c +++ b/tools/testing/selftests/net/tcp_ao/unsigned-md5.c @@ -100,10 +100,10 @@ static void try_accept(const char *tst_name, unsigned int port, after_cnt = netstat_get_one(cnt_name, NULL); if (after_cnt <= before_cnt) { - test_fail("%s: %s counter did not increase: %zu <= %zu", + test_fail("%s: %s counter did not increase: %" PRIu64 " <= %" PRIu64, tst_name, cnt_name, after_cnt, before_cnt); } else { - test_ok("%s: counter %s increased %zu => %zu", + test_ok("%s: counter %s increased %" PRIu64 " => %" PRIu64, tst_name, cnt_name, before_cnt, after_cnt); } if (ao_addr)