From patchwork Fri Feb 2 02:24:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Safonov X-Patchwork-Id: 195527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp162968dyc; Thu, 1 Feb 2024 18:25:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5j8SVkMkxKCs1bZLGFSc7TP38LFcHPKgvy+acQoAH9qMogrzrM9FaReo2BPSl8pZlJfoB X-Received: by 2002:a05:622a:d2:b0:42b:ffb5:cece with SMTP id p18-20020a05622a00d200b0042bffb5cecemr1775167qtw.27.1706840732105; Thu, 01 Feb 2024 18:25:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706840732; cv=pass; d=google.com; s=arc-20160816; b=OfPdgEF/32zlN31iRp7PbHXBEnJXD5TnpTqsyVzykLn21LTsH8NBckXMyfqQzq1xnG z1diDbsdTuxioBGelZHMfJanrgdAe15FskxfTlCLtH8Wa24291MO0huSYjYcym0WMW0z lN2fwRFAksLlm//7sxMc9qu+Oz2L/5pqr3OO5O83utlLkMKhA0OorkFEOLf3KXeEcAWT V2f7W8Uuv3+U2nks6Pke9Q2PnThQHDmGtEIZOFe3WKkcGcT6CMN81Sg13UgYSkljv6/R VN9clos18HofTVKxMjFCZ9CsSdl/V+UQtbA5/MMDFGKoO6rqJ1+g3crszCpASZhppTSh yO/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=5+MYOUdkffZklmJiRyDcBSvfexdw+Ug/dwNFb912Mic=; fh=kUWHi/0U2KzZvkWA3cKaXO88q/J/IoMPGB1c9GLh0OI=; b=ZcXdhvTyZkPzBOEmjtZGgg516ZEkUE60YSSF2ixQwX02ZrrcrahQYTZmL1DinnRfS8 5/kAOCjZkaywnVsE7ep7FQ8D9IX8X/atOXaztA7vyQoFhoN1nSPKFewQAJ1gY5HSq32Q W5hMsKCNC+WI1ZN1+j8qYAxGr5t6HQJdkDHAJsYC/LJdWJn9mzYfJvgg8z/DWvZbwiH/ TdlGMHmyXymcup4JkS21GRJsnnMyLsS14lIKQlPz4a2H2OyqGEuRMZWwbT2LpE6ZiiHa RtKPn2J/7M2qkn0pabEZJ60IrJiy6zwZaW2Vn0yJ4D989p5I++HJiyo8T67eWGJRl5rS PR5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arista.com header.s=google header.b=frbL0wz1; arc=pass (i=1 spf=pass spfdomain=arista.com dkim=pass dkdomain=arista.com dmarc=pass fromdomain=arista.com); spf=pass (google.com: domain of linux-kernel+bounces-49087-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49087-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=arista.com X-Forwarded-Encrypted: i=1; AJvYcCU++A9UTnJMv0UuuEVmqNYqRGT+e4IfO1s5WgJKRjcL3HV0ub0gLHGyOJFHp/GoPgQgH5TInOduQaDJdZ4sJtJyLntlyg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d13-20020ac85acd000000b0042befc1aa34si1005003qtd.73.2024.02.01.18.25.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 18:25:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49087-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=google header.b=frbL0wz1; arc=pass (i=1 spf=pass spfdomain=arista.com dkim=pass dkdomain=arista.com dmarc=pass fromdomain=arista.com); spf=pass (google.com: domain of linux-kernel+bounces-49087-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49087-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=arista.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D29001C225DA for ; Fri, 2 Feb 2024 02:25:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BAE5C2CE; Fri, 2 Feb 2024 02:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arista.com header.i=@arista.com header.b="frbL0wz1" Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F89FBE5A for ; Fri, 2 Feb 2024 02:25:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706840712; cv=none; b=pc6u/laYbcMr/vnIccc9ixB3gYOpkEdK0vEZP0WPwcV8Sp2vqBjBioF4v9yMBkUvUeD5t+ciJfRcRIm4h5/W9USaHKlj9A0CzNFe2leZh5RXpBAI5Dk40gvXE1VDsYAw/qtCYpxyiIOGAaosRfkUIDFbOY5a+3NHIVtkpj/oyig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706840712; c=relaxed/simple; bh=9N2iU88+gARQNe6fozJMjFI5OkOXZkUyFALlpWKir8s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=i65sC8422FfelaE2IUBr9xEfEVeDb2UVbnK9k6il7DbAaO6D6AtHz6AvtJuJXKVtVhbM3Y51SgmsMZK4CjGRdh6zxA1NU4q6dkVbquvf/2jNpWSiw3UR+i7PTc1j83Iip3RH0vTe80KT4TGJmoJ7OJQXq+Ruk6fFtw6AuaDbhCI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=arista.com; spf=pass smtp.mailfrom=arista.com; dkim=pass (2048-bit key) header.d=arista.com header.i=@arista.com header.b=frbL0wz1; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=arista.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arista.com Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-40e76626170so13385765e9.2 for ; Thu, 01 Feb 2024 18:25:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=google; t=1706840709; x=1707445509; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5+MYOUdkffZklmJiRyDcBSvfexdw+Ug/dwNFb912Mic=; b=frbL0wz1UmxnOBA5ovKX05Ts7a3K0TlLlKRG2bDTohnp8LoLAnyt56C6UR9d+CH0Yc FuJiapWXxscrm/qaCPYqWvhvTweU063XysN6at25XE6NmtxeRmm5K8ypX5mWUC3auhXt dgzc9eq5HhlNkRwW3iJgHaXRlZvhjEPTfJKn3qf6v6GURY3/eRYzhcMlB40l+kHQ2uEU k22Hg7Xpz/8bG7MvkS5UUpmZXpYhnJFM5p1zgiDXDKqjazCZDVRgBzkmJM25+HCcYxj8 28XrBWPNGxCUPSl5EtJGRLIYIi2ST8IThJuaa01tg/EvBrMq4sF6ND6oe6P4U4ZEkxqZ 9Ekw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706840709; x=1707445509; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5+MYOUdkffZklmJiRyDcBSvfexdw+Ug/dwNFb912Mic=; b=mpwCudIGDE8NIJWk1CT5qVqDAU8+B4Qs7WlLA62auzu6mwUCUCYNPXPCxwa042j1nB iHgZCGMSqtC8vHvT3f84sGjBEqcKMpanlcdGSXJWd2tP77KY0v0VwbWp6FkFMBkhZQVu Gy5/RMHMO6ivwTZoO0dYUe0dofyT2xwc+Diolpv++7Tpv7MKf3LW89Efyrs6Bp+5cYeo 1DeouyCnG0ucdcJ4q0PjZXAzd5kuFdLnGakUONGDSapGmGSUN0zZMtcjZdO9ONtdZ5oa Zc6Q0iss/VuAP0osH7rghM4zhgsitUs2lg9te8wa9cq4EXnLr5KNDoff6WPHslNYODMs QYow== X-Gm-Message-State: AOJu0Yz1z7dr+VMW7CNcFYGEdVSPGZs4o7zxeeu66FaoP8sFUyD1aA72 TS2jVu+vo+Up8QZCcnY5/sKqVX1saX6sThtXNP4t1OUejifC0qF7UbTMMAa8Cg== X-Received: by 2002:a05:600c:1e09:b0:40e:e839:82d3 with SMTP id ay9-20020a05600c1e0900b0040ee83982d3mr558787wmb.20.1706840708752; Thu, 01 Feb 2024 18:25:08 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVxrAidf68sKuOnQRo82PhZxVEETGD8gQt1wMzSdK5oZVhC3f7C4bCzGBZPilM1QM3clRcjoHMVeBfNy8z6CipHoaMrSIKBWu9MT3MjibepjVJZTx9N7qj6AIKxw5eW21ot8gfK1Ldw9uDRUN/fmuQzcNR+7HZMsRJztUONVQTZ0DZ33/idL/7sWEdICOhwKDn7pOv0Ai3dSgG2oQp1kCmtax51lFGdszk4WMAzBzDBk2Oke5mintYVzQ6fTaMDIeWo0wNpXY2/qg24Qnbra4bGeFFwNCOfQLI44y1fEFKU7aEdtwbuI/20aq2dyt8tw4b+6MgNEu/bEG5f8ccXOFhfIskTTSmo8V0NASEp Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id f8-20020a05600c4e8800b0040f22171921sm1201476wmq.3.2024.02.01.18.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 18:25:07 -0800 (PST) From: Dmitry Safonov To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Dmitry Safonov , Dmitry Safonov <0x7f454c46@gmail.com>, Simon Horman , Mohammad Nassiri , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests/net: Amend per-netns counter checks Date: Fri, 2 Feb 2024 02:24:59 +0000 Message-ID: <20240202-unsigned-md5-netns-counters-v1-1-8b90c37c0566@arista.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.13-dev-b6b4b X-Developer-Signature: v=1; a=ed25519-sha256; t=1706840700; l=2805; i=dima@arista.com; s=20231212; h=from:subject:message-id; bh=9N2iU88+gARQNe6fozJMjFI5OkOXZkUyFALlpWKir8s=; b=Puw0xgLo615QE2e5RmlZ8jpNiFzXn/gxginyxBI+5ARAFf3Yf/fwt1KlR7ELKNDr5xs5BwLnh Vt+269xSIvFDDBwXaQR/uQqRY+N8HWQp2YYJrQKGvZFm1ELDkbYIv2F X-Developer-Key: i=dima@arista.com; a=ed25519; pk=hXINUhX25b0D/zWBKvd6zkvH7W2rcwh/CH6cjEa3OTk= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789752227445129844 X-GMAIL-MSGID: 1789752227445129844 Selftests here check not only that connect()/accept() for TCP-AO/TCP-MD5/non-signed-TCP combinations do/don't establish connections, but also counters: those are per-AO-key, per-socket and per-netns. The counters are checked on the server's side, as the server listener has TCP-AO/TCP-MD5/no keys for different peers. All tests run in the same namespaces with the same veth pair, created in test_init(). After close() in both client and server, the sides go through the regular FIN/ACK + FIN/ACK sequence, which goes in the background. If the selftest has already started a new testing scenario, read per-netns counters - it may fail in the end iff it doesn't expect the TCPAOGood per-netns counters go up during the test. Let's just kill both TCP-AO sides - that will avoid any asynchronous background TCP-AO segments going to either sides. Reported-by: Jakub Kicinski Closes: https://lore.kernel.org/all/20240201132153.4d68f45e@kernel.org/T/#u Fixes: 6f0c472a6815 ("selftests/net: Add TCP-AO + TCP-MD5 + no sign listen socket tests") Signed-off-by: Dmitry Safonov --- tools/testing/selftests/net/tcp_ao/unsigned-md5.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- base-commit: 021533194476035883300d60fbb3136426ac8ea5 change-id: 20240202-unsigned-md5-netns-counters-35134409362a Best regards, diff --git a/tools/testing/selftests/net/tcp_ao/unsigned-md5.c b/tools/testing/selftests/net/tcp_ao/unsigned-md5.c index c5b568cd7d90..6b59a652159f 100644 --- a/tools/testing/selftests/net/tcp_ao/unsigned-md5.c +++ b/tools/testing/selftests/net/tcp_ao/unsigned-md5.c @@ -110,9 +110,9 @@ static void try_accept(const char *tst_name, unsigned int port, test_tcp_ao_counters_cmp(tst_name, &ao_cnt1, &ao_cnt2, cnt_expected); out: - synchronize_threads(); /* close() */ + synchronize_threads(); /* test_kill_sk() */ if (sk > 0) - close(sk); + test_kill_sk(sk); } static void server_add_routes(void) @@ -302,10 +302,10 @@ static void try_connect(const char *tst_name, unsigned int port, test_ok("%s: connected", tst_name); out: - synchronize_threads(); /* close() */ + synchronize_threads(); /* test_kill_sk() */ /* _test_connect_socket() cleans up on failure */ if (ret > 0) - close(sk); + test_kill_sk(sk); } #define PREINSTALL_MD5_FIRST BIT(0) @@ -486,10 +486,10 @@ static void try_to_add(const char *tst_name, unsigned int port, } out: - synchronize_threads(); /* close() */ + synchronize_threads(); /* test_kill_sk() */ /* _test_connect_socket() cleans up on failure */ if (ret > 0) - close(sk); + test_kill_sk(sk); } static void client_add_ip(union tcp_addr *client, const char *ip)