From patchwork Wed Nov 30 14:06:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059897 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2FC2C433FE for ; Wed, 30 Nov 2022 14:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbiK3OHl (ORCPT ); Wed, 30 Nov 2022 09:07:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229898AbiK3OHX (ORCPT ); Wed, 30 Nov 2022 09:07:23 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D641D7721E for ; Wed, 30 Nov 2022 06:06:57 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id r26so22089272edc.10 for ; Wed, 30 Nov 2022 06:06:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KQO2/gt+7UaIdXHENQ5ZaxLgiM9C0b2kktLfe3u7CaA=; b=UP5IDyaYKAbQYwyPEVFU9u9jRWhTaimdQwDrnYu0VwshzwnFrDvEL9sdFfB1hicvJU gJct9ZZX1jFbJzKCqeSiedksAXrUtYxVL0RctQpKt3tyXG+/bKZWkraNR/0Ftb/C8ps3 2CJ+SSAOmCKYSuibkG2+NSE80c2bQVIW/+oQAhQMa/43oJNA+P/AoY4l2EpenKSb+QID Czwaxgipp3E/bFZq6z2iijLpQTqxeIehkerBafnN5J9FPYaxn/Ara34DyrwjYo7+3p4Z t6ESno+WYUCzwyrF+wJojkUUNgoO37g8pDD4sgFBZ+ke4iPz4xCQzDaLccDSEGfI2pKk 01nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KQO2/gt+7UaIdXHENQ5ZaxLgiM9C0b2kktLfe3u7CaA=; b=K3QjcL5KmGBBAoluhA3CdJ0xPYNmXN7V9Ow/RJmt7h9VLkXFU3YyvDBreH5Bc/1/4g XNGOCtIqBvC/hURulZVA5xjIO0mAuw2saNUbg9QWB7EqLzmXOtewNuEACfrKW+ltPbuR ugt5LDXm90PzwHTYy4nzSUKhnGLmip+5o1txsSdM1GPe/NisogdgSXvOsWP9U3TX12pS mx/dYObldc75+ktGBgAsYsf4vwGxHlSqmtVEhrcIMFtevQQMTNjRn9ctBgvM6YKijUe4 lUGo1dC7K40qVrUTlJcJ8eawuSS5Ctc0Z9JttgnTLE0Gn+0BnsvSGrjveKYa0asxywLh MDjA== X-Gm-Message-State: ANoB5pnSqusJM9eb53PMlIanPgqEFaK8V7ZFuo+2a1UHd7hSiS4C5aZr Wh2q/+RQWahmts8vAe6Tel6bEw== X-Google-Smtp-Source: AA0mqf6ggzzPvQ3J2jOw7BrYgDyTjNWOleO13OYDUTtaLi+CbbmMsBCWXvDPCuEq/IJWsgNh6G/qGw== X-Received: by 2002:a05:6402:110d:b0:469:dd6:bfee with SMTP id u13-20020a056402110d00b004690dd6bfeemr40142074edv.330.1669817216324; Wed, 30 Nov 2022 06:06:56 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:06:55 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 01/11] selftests: mptcp: run mptcp_inq from a clean netns Date: Wed, 30 Nov 2022 15:06:23 +0100 Message-Id: <20221130140637.409926-2-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1101; i=matthieu.baerts@tessares.net; h=from:subject; bh=21EHdex0rQiARRVFRiFLSu+im/TNbuOJS38o4ruu26M=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2Nnct4H0wj83WZH/+oM+MXHQnuCT8T9+BqudzJn xpwH41OJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djZwAKCRD2t4JPQmmgcwqOEA CXuREgN2zrT/bFDdL+YwSLjhAaLLXwGqs7Fvlkm7CdjnCE1vzNtTZ/1ZS8hq5aLaSxJVTY3DOoDF/9 dY4X27Cp79Yzl/OXt53OWqQfAsaJ+/dxnNTiUGr2oZfN+fLLKKwDWZ6YiYjRBOO7zq6FllTQ9jtBsY egeBsY8u/abuBiyhL/x5KnhZfaKAuBeFPOu6bsE4sunZf4TadIABgztQ01OEAS75eot2Ik6kNFvs0n bKgTUriGwAsZD3b0WjoO8lEZDGfJ0KWL3ju7rjQNHAHCuAJB0Q0ywzRCAJSsXuYo2wM+mnQZp/pEb8 Ec5L4zg5VNgz1AU1eP9eTp8QdmG06ymYr0Enr2QMJgqI3crCDH3zaOXEyU1WLSL19RxptbcrE6z4Ai ur0goV7R2R5DH9n341fjWODrrDXPtDel2QYnGHjr/EGLkeB+p1YNbzXfiKs+r6IxgKogYlKPQRB0AC Zd/ntthZvW8C4IQux8g/zyOy/hY9d4FzThIOvImWQ2Pr5Ntda+V7Poz9nA4RU08XbsKGX8uawCpP1q HbYcO69O3zB4tEk3fNGN9NmblsIj8fIcV60YPuVbRii01QgmD2mDIEAhmrZIkZaoVC1fHK2UXv2ztw J7mQE/ZVAyHHr5Gu850ARa4bnxt+wiVQB0EJK+6BCL+4CWFrjCCs0QM50uaA== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org A new "sandbox" net namespace is available where no other netfilter rules have been added. Use this new netns instead of re-using "ns1" and clean it. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index 80d36f7cfee8..8a83100b212e 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -282,7 +282,7 @@ run_tests() do_tcpinq_test() { - ip netns exec "$ns1" ./mptcp_inq "$@" + ip netns exec "$ns_sbox" ./mptcp_inq "$@" lret=$? if [ $lret -ne 0 ];then ret=$lret @@ -298,9 +298,6 @@ do_tcpinq_tests() { local lret=0 - ip netns exec "$ns1" iptables -F - ip netns exec "$ns1" ip6tables -F - for args in "-t tcp" "-r tcp"; do do_tcpinq_test $args lret=$? From patchwork Wed Nov 30 14:06:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059899 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A70B0C4332F for ; Wed, 30 Nov 2022 14:07:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229915AbiK3OHr (ORCPT ); Wed, 30 Nov 2022 09:07:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbiK3OHZ (ORCPT ); Wed, 30 Nov 2022 09:07:25 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 784837721B for ; Wed, 30 Nov 2022 06:06:59 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id ha10so41656030ejb.3 for ; Wed, 30 Nov 2022 06:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YJH7/Ya+JyhHFNUH8pzKI3Kt+nJBKR+LqkahaTkfV5I=; b=N8NKMeRx8eBoPndC0IEgHED+IAsMA6L1HKjkGU1xUTt0TJ5NdQfo7JNV6/ezwVk1pX FxoASo3jluQDvBFl7h5iM4eORI0rXG0egaGqluwsV2vH+3ZF2aHxjRiI6MRlT/5JPVJQ iyF/IPa59hFeVo1lIMS+AhE4Ky++In1nQ3S381aGdwBNZc7m8fccTPJabNujGCFtQYA9 k/Hn8Yeencmut/lCGql1siRDF9kDmTxk/OaARbRfDBbJynmzQwMfr/FZTZD14J6N8u8l e3d/E2GMFqmKgBys0T4j8q5JYjKF8JphuFmHdw3iqxidvNAMqBwGuSk0eZKKzlyefG8g In4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YJH7/Ya+JyhHFNUH8pzKI3Kt+nJBKR+LqkahaTkfV5I=; b=RvWmTwRp0VuIijXuNigVoeuPKa7VnJEDXVTu/sezD7gAJxhd4tzcSKjksB8gCKCJgM pf36/9W4VtHv2Bz5q/nU62xTcYB0k5mzVemS8xBE/CtT7ZTGZeGyfVnfDEoH2XOi6TXs NUV2M4wbVANO5no9e7+AcvMbQYLXcBn+FJUzLqw7U7QubqxrcslEYBeE8e0IX9IiEnt0 /I+4yo4zzdRp3YrXKpgMnFXYWZAiXoVqpCG0O4JMS2pHY2/of0aJp5qJDx9Z4MgMHcZj YaCyMTgT2bMr18iRzEDixRfbfuAD+fchNoNuxb9asX02xaaJsjVkHAks5wAWoCqeC6cS hP6g== X-Gm-Message-State: ANoB5pna5fkAdY9HBb6Xyc9DyJmx/F7ahICD5ajDTetcylnu6F9/uBdv cll54hGHbpqkaYc9o3myLw6LmA== X-Google-Smtp-Source: AA0mqf4Lkeav61h8g7hIlIxLe2otfwL1RA9e2hfJzeHqtmbHlqQ8FAE7SI3tg9X+iRkCatYOSCRI3w== X-Received: by 2002:a17:906:6dd5:b0:78d:a633:b55 with SMTP id j21-20020a1709066dd500b0078da6330b55mr54279279ejt.106.1669817217863; Wed, 30 Nov 2022 06:06:57 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:06:57 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 02/11] selftests: mptcp: removed defined but unused vars Date: Wed, 30 Nov 2022 15:06:24 +0100 Message-Id: <20221130140637.409926-3-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2295; i=matthieu.baerts@tessares.net; h=from:subject; bh=x2a5qXK0yM6mpMP24fRnfIxNbSZvxgQ2hoKgZvqEjqI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NoxlLLl9Cj2G+5X81Y1LEfhwImH+JGnKgyGGmf RrADQnyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaAAKCRD2t4JPQmmgc4ATD/ 9eQFrcQ4TSgTaUEypoG6ENRiEGmyIJVDitTU5FxirYDYwZ2a7nife79aF2LHWEj1fVbb9eIGJa6X0d Ec3fPSmG6hO+NgWFQmu/fE9KzxJgf/aNqHbB6NQtz4ImrUlsGxxB7ft94p7tSTsjQ+/lYuf/11IR4m 74zppZAVKtrDHalU+/iNg4sO/VrxRFk4JyCDbyQRLulobTMzReyClTEdUEXkFujwDHsPsKQavoZtAa TkbYHuzqAeWGDaU9mHi20vuRNYg+OptrRebS1XTOlkM4sWCwIhhN5LGd4P6HVMGWbFnUUrBqUkOf9P 0DX0od4qK2T2W6+q0mPFij0NfMbFzlIOiNcbG82H+SA3as/iROZotRk76V5kUX1lcxcg38abayrCjI VrpIYrPn2smzUtNVDI7g4Luve1InQAZspJGcYPhQjUz5MEc9ZBaMJZl85K7RfytiLV/krj+fWxSe4F f37+0qdI4HsvO6PWegJkY3WcFaFXPOkp2n/CGERnVuzQvsZPA3UhQHbYAhgYILgQSxguJFD0GQOo7+ HDMiQLWjNzDazSGJBco7ISmH2PZOF9/OPk7305DWhp/v7OamYSjXuzQ48UIYjE7YZ34qZD7gJGwsUq jdGSzCbeIEhMGaflUu9pvPm18L15IvRC1WrbByY97R6BrTj7uawSALMxVEJw== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Some variables were set but never used. This was not causing any issues except adding some confusion and having shellcheck complaining about them. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 3 --- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 1 - tools/testing/selftests/net/mptcp/simult_flows.sh | 3 --- 3 files changed, 7 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh index 60198b91a530..63b722b505e5 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -781,7 +781,6 @@ run_tests_mptfo() run_tests_disconnect() { - local peekmode="$1" local old_cin=$cin local old_sin=$sin @@ -789,7 +788,6 @@ run_tests_disconnect() # force do_transfer to cope with the multiple tranmissions sin="$cin.disconnect" - sin_disconnect=$old_sin cin="$cin.disconnect" cin_disconnect="$old_cin" connect_per_transfer=3 @@ -800,7 +798,6 @@ run_tests_disconnect() # restore previous status sin=$old_sin - sin_disconnect="$cout".disconnect cin=$old_cin cin_disconnect="$cin".disconnect connect_per_transfer=1 diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index 8a83100b212e..6e8f4599cc44 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -10,7 +10,6 @@ ksft_skip=4 timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) mptcp_connect="" -do_all_tests=1 add_mark_rules() { diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index a5aeefd58ab3..189a664aed81 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -148,9 +148,6 @@ do_transfer() :> "$sout" :> "$capout" - local addr_port - addr_port=$(printf "%s:%d" ${connect_addr} ${port}) - if $capture; then local capuser if [ -z $SUDO_USER ] ; then From patchwork Wed Nov 30 14:06:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059900 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EC8DC352A1 for ; Wed, 30 Nov 2022 14:07:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbiK3OHu (ORCPT ); Wed, 30 Nov 2022 09:07:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbiK3OH0 (ORCPT ); Wed, 30 Nov 2022 09:07:26 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57989663ED for ; Wed, 30 Nov 2022 06:07:01 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id ha10so41656304ejb.3 for ; Wed, 30 Nov 2022 06:07:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aBj/U42gqgyxFUVrg5VQBmaofMncAmVJOsdRq/xN5Pc=; b=NU5tWU08fHE1TTgVHomqTdpYrqbrIf5tIko5VY5yPUNv98/0JlYv0z+QbcuTaDrn1g 3Z0COWJO++GCtfc9NXGJmPEJcKQeABWWUfxIKCpyMBeIusxr0ZrKn+m0WlsYfYPKF0up 8Yk7flMl2X2Enfj1c3PyCCU71kQdBQxNS5X3YRXp64PrK0Qd1qwhvcg5mf+BFr2RC8mn lIDO2MLV6EAkZXA1hZF2su0yqTvYP8r/0AmN+EVePxamAiqcnGtwhLCA8vDdgem2EYtn Bf53TSGSok1P5Ki/NhjFqNY44qCuQHRHXp5R7OM2aekPzcrzvjDLIVgPsO7aOLRN0KWu Er6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aBj/U42gqgyxFUVrg5VQBmaofMncAmVJOsdRq/xN5Pc=; b=EpoliAnvxaPhPK+yvaCZGe1x6sJ7XnXmVd5O9N0zk7w77K//+Px38PfdroZ4CqyEOL Zw8Nwk8XXLIiOVBhXso1d2SqapnGYTOnXbFLQR5t23ixUK4w6UjpjiaBr4S+kjdguAK9 wtFL9YQP62aODAiNJ7v1G8Wp4jPuIYal82K59nGwCUP6H2PyAdjLR0xkTmhy604EGOST WHqPKc/8bi4NVoszNfSFv13GdykEUbz+ruYygHbVqbSNIaShayysMqjNEZeqdtnkIBeS xeNXOJOAjZsSTT/n2llMKKVbo46HIPrs8LrdislGChRgSQRYlNt5u4meaATb+OohvGV6 Xkfg== X-Gm-Message-State: ANoB5pmbdAFp+o9sziwqY7gdTD+pyAxJP1GbirCUW0SqklnPBsnBdhN9 wXxbJ70d/kZ+HciOYKzLw8sP7Q== X-Google-Smtp-Source: AA0mqf4xvaSPBJ1Fh+TBfwNKz8pveAReQVkfUE1V97XbMJvkKYWfWQ3PzFquOMo+4NAUZTwurzC+wQ== X-Received: by 2002:a17:907:900f:b0:7c0:9879:38d4 with SMTP id ay15-20020a170907900f00b007c0987938d4mr3871460ejc.746.1669817219774; Wed, 30 Nov 2022 06:06:59 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:06:59 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 03/11] selftests: mptcp: uniform 'rndh' variable Date: Wed, 30 Nov 2022 15:06:25 +0100 Message-Id: <20221130140637.409926-4-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3621; i=matthieu.baerts@tessares.net; h=from:subject; bh=czOc1nAblZhAn2DlORqpq06aMc8ExsLsax85fE7Q4Qk=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2Nol4cUE4IpE/zP1tt/xCYKkzvQ42ktz7h9FiIY DoerSeeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaAAKCRD2t4JPQmmgcwdIEA DIltlOcGse4BX3HAl47DtvDjhakb4Bw06Mel15849x658xaDBDla96q3PTR9C3UMH2KKcA0ea4sjUg UJd2YoQ7VF3IRziKDh0/MO/VeIQaHyJ5JdWVB4jxjSG5+KEQcTZebQME5+xb6+cyo15HUWPJyU+h+N 9eykHcuJKCS3bizVWZSH/YRGxaxByZKEcC4JVQV6wQDxIJq/b7pg6tPZ6WthRU6xvDYm/5Gv1exW1y RhBJx81T0DFPzEDNdb71wCY3ZflU+nz10bLgpapFLNvAmaFTqDLIPhPbfSHZ78KVAabcb5Eni93Ohz A4MCEhpvBRAtk2wEhY7DUDPZlCOj8ag44vIqAZzNEIWUzrvDPxRCLyGsreDK9AfiKKZIUY0sY1LllE BwWT3Eqxqfsxv4oO5JOmPfjRkxJZl9YERZIDh2Rf4o/cD7hjHJ8Hd7ZdH5cQUtXh7swyFcDST1csDr UJMa9qohkLwVBfZJ/eVJ9gKr/cJVSWN2IvvNKEExTHhle6PCq1+dKLbDQZx6ZjN7Y1lq47r4s8Nml3 Uyd5vTn65hja1g6zhkVobRxfnUuxBtD7nZtyNZ/AsNmb0TkcjUOZXErSyemdklrT38fkbtlKHFzvQv P73kRx66KSufaY5kcjvaTOM/NF7oF5XwzgyjEnSFZtCN71AqeGOsv7PRn/AQ== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The definition of 'rndh' was probably copied from one script to another but some times, 'sec' was not defined, not used and/or not spelled properly. Here all the 'rndh' are now defined the same way. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/diag.sh | 1 + tools/testing/selftests/net/mptcp/mptcp_connect.sh | 3 +-- tools/testing/selftests/net/mptcp/mptcp_join.sh | 5 +++-- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 2 ++ tools/testing/selftests/net/mptcp/simult_flows.sh | 1 + tools/testing/selftests/net/mptcp/userspace_pm.sh | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index 515859a5168b..24bcd7b9bdb2 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -1,6 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +sec=$(date +%s) rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ns="ns1-$rndh" ksft_skip=4 diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh index 63b722b505e5..a43d3e2f59bb 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -274,8 +274,7 @@ check_transfer() check_mptcp_disabled() { - local disabled_ns - disabled_ns="ns_disabled-$sech-$(mktemp -u XXXXXX)" + local disabled_ns="ns_disabled-$rndh" ip netns add ${disabled_ns} || exit $ksft_skip # net.mptcp.enabled should be enabled by default diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 2eeaf4aca644..2a402b3b771f 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -59,8 +59,9 @@ init_partial() { capout=$(mktemp) - local rndh - rndh=$(mktemp -u XXXXXX) + local sec rndh + sec=$(date +%s) + rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ns1="ns1-$rndh" ns2="ns2-$rndh" diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index 6e8f4599cc44..dbee386450f3 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -30,6 +30,8 @@ add_mark_rules() init() { + local sec rndh + sec=$(date +%s) rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ns1="ns1-$rndh" diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index 189a664aed81..9f22f7e5027d 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -1,6 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +sec=$(date +%s) rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ns1="ns1-$rndh" ns2="ns2-$rndh" diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 3229725b64b0..5dfc3ee74b98 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -33,7 +33,7 @@ client_addr_id=${RANDOM:0:2} server_addr_id=${RANDOM:0:2} sec=$(date +%s) -rndh=$(stdbuf -o0 -e0 printf %x "$sec")-$(mktemp -u XXXXXX) +rndh=$(printf %x "$sec")-$(mktemp -u XXXXXX) ns1="ns1-$rndh" ns2="ns2-$rndh" From patchwork Wed Nov 30 14:06:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059901 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 727B3C4332F for ; Wed, 30 Nov 2022 14:07:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229955AbiK3OHw (ORCPT ); Wed, 30 Nov 2022 09:07:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbiK3OHa (ORCPT ); Wed, 30 Nov 2022 09:07:30 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F75D77220 for ; Wed, 30 Nov 2022 06:07:04 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id bj12so41517810ejb.13 for ; Wed, 30 Nov 2022 06:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IXRqop1kGCEX2u8HK3BLrgeD9xK0rFoNB2L0UfRu0sg=; b=v006RZGKNhV7QldYcKIzJsCYNB63Tfp5FEfdFmJp6bROQIuqlnk8+FKbW7+BQPm+Pp zOFNnSXmfagXgOSLKxFs3oROvyDkHghKcrDA9NxWVlHOLUnZ8OM+Z8uSLIs8p7hA/rv9 pnl/w3ie8D/tGrXuDFnTxTNKHdp/ZusM67kXjNzHCcQDhAsqKdwZW26VkHNMCGmftWaU EbMGpaDORdqqdOCO1/imCDSQXswP2t+1j4KZ4L8udoAYRYbhVPDDz+9xzQPlK1w+e3jV jwVPhPV6VB74LpQnBqQob/ZZW34U02qr9YRFSzBEFJS2cotxPXsoSqh9xy+CGrRSSEXx MBAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IXRqop1kGCEX2u8HK3BLrgeD9xK0rFoNB2L0UfRu0sg=; b=Zz4oxppTFcOwihrayb0ZttEIiUbysCUSOlP+2CtV9zwnjIL0TnqC8QdQJ9/ut1IOXJ 5tGqKT6zjwtYaSBSrtLh/NG+/OF2L5f/4XsS+MrCovQpxBBX2Oe+Rv8UuFaVSJHzAsAL wA/DSy9g2AdKUMLh5IxoO5ZsMh70DNtGUqAlzfuni0skIKIDPFlc3YJkm1Gqxj1RNxQu vdMjyyJNhFeOENhxY/TYCbselVsVSES9p2qNGv/OP7XR3sjTn3X8p+L9JK94QmUcLTgH 19vk3b9OGBQO8r7MLUbDosM4fE2ZZrnDLUi0vxZ7TpCf+HK2+2oFsRDnQNbr5ZpUN8Sd pNFw== X-Gm-Message-State: ANoB5pk8rZBZk3ijnxq91gVdX0MzzMowMHJ0lxRP39cQIoR5xxQPPzp1 t2gIF020rMICQreoAa9W5EjroA== X-Google-Smtp-Source: AA0mqf5Qkten+sdz5wTXblKGqR7rZD+RmmlVt4D0tNeFA1XdsS9NPPsgEi01P7NfbalH9380k5PJUQ== X-Received: by 2002:a17:906:89a3:b0:78d:408a:4a18 with SMTP id gg35-20020a17090689a300b0078d408a4a18mr52479961ejc.261.1669817221279; Wed, 30 Nov 2022 06:07:01 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:07:00 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 04/11] selftests: mptcp: clearly declare global ns vars Date: Wed, 30 Nov 2022 15:06:26 +0100 Message-Id: <20221130140637.409926-5-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1440; i=matthieu.baerts@tessares.net; h=from:subject; bh=vm+YLBU/ZtD1x+WUlv2naFFwGpGoYmoqnp2qkgB760M=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NouvnL/n/xWVXPFT9olXEh+lvvARvqTTsiHK9z UqifJbeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaAAKCRD2t4JPQmmgc46LD/ 4yS1d70STmWag1bHFpeVw3ewfxgyI0JTsJlKmrxDdeXnjRoj8sRHXrkRobl50q/96ApVaXpU97L1nQ BCXBSV0x+sbrHOLpGn8KHxVdse30n4D9woXwWRc+FNi8XPiPLnFPWM0tEK8ygBLYxE1w9dlyD5NZwA cPKp0P8s//huK0fLkK7iE4uppBFbGqm5YIarbemAWgLeaAFSaXlX2V9wzFMkFR32oKceqLDFv92nV9 qMnm5xhVyE9756j696iw/TAjOxTtDvCha6mPq/LM94udQH+VAnbfB2LLKZboXCK6cXn1YQe5nbf/zn ru9NnJrCZ6aZQEKqsW0djOKuAFEhCO/K9aDRAlfPtAorL6ECoxP8b42b+HxZe8TB3/5maYXsgaJkHd EWfdH6S2L4GnxAodoQ723QJNi10w/9idJUH+TsDUcOSUJesB9FTepZtryG10/FDh/OeibPk/wfjCQH VC9dpfuC7rw+jyuJ5NfCQAlylCWYau/6+4U2ufgfSu2HUUmP0zk0NzTDBnpHEz8lbA3BEwS0xsIaiL pbSoSyJyXIoAyQeVkiZXPteRcf56y29vQgytqdcbcAFu2f2Rlg1pcHAydtGf41Ot/a/f1QZxgTnavG kDVBiiYLFdns8jD69enBIwfKdGmXIsxTVpmaYQaqegnwjLrTGyhAOvN34Lnw== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org It is clearer to declare these global variables at the beginning of the file as it is done in other MPTCP selftests rather than in functions in the middle of the script. So for uniformity reason, we can do the same here in mptcp_sockopt.sh. Suggested-by: Geliang Tang Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index dbee386450f3..f74b237bcb32 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -11,6 +11,12 @@ timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) mptcp_connect="" +sec=$(date +%s) +rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) +ns1="ns1-$rndh" +ns2="ns2-$rndh" +ns_sbox="ns_sbox-$rndh" + add_mark_rules() { local ns=$1 @@ -30,14 +36,6 @@ add_mark_rules() init() { - local sec rndh - sec=$(date +%s) - rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) - - ns1="ns1-$rndh" - ns2="ns2-$rndh" - ns_sbox="ns_sbox-$rndh" - for netns in "$ns1" "$ns2" "$ns_sbox";do ip netns add $netns || exit $ksft_skip ip -net $netns link set lo up From patchwork Wed Nov 30 14:06:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059902 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F7D7C433FE for ; Wed, 30 Nov 2022 14:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229798AbiK3OIE (ORCPT ); Wed, 30 Nov 2022 09:08:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbiK3OHc (ORCPT ); Wed, 30 Nov 2022 09:07:32 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A346C769F8 for ; Wed, 30 Nov 2022 06:07:04 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id z20so24174469edc.13 for ; Wed, 30 Nov 2022 06:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2vVvw7X/GbK1uw8NEy53Xer3Z7d7cB2KBB5y6WQtaEk=; b=XjUBpqcyqHxCl5bbgK7jToBOpwvQAdUjlUDfSdYpBivtym6A7Hjy9Ji9GWxsGn35wu whAgDCdPd0+GO3yKt9nTej1ougdD6W4+ONtAezMQEVHMah486nU2eRHa2Ze8lG1NGP7M Hzt4+vwj8IFJmGxXExxQK9QtOMP3vKsTLDGX7kMKZUGHqmi8XiqPQDuCtaIZ6Vy94vGg SoLlDV3wxdqceLXYUY8iY3KA3BQp+PuzlZdU7XeG252hFcD5T8JuexAobFdMDTNK2NAP X3ijy5gFhsZF7TcmD/uoEgrgBPPjTRr/4kjw6a0a0gyF5ZEJLU3gA7i9qEC+2m2hSpHb 8cZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2vVvw7X/GbK1uw8NEy53Xer3Z7d7cB2KBB5y6WQtaEk=; b=N1PBh45LekUGp2hF79iDJ8/FUjbXxG3SfoPyO6Tl2QwbZ0FnJ6GoWSYBdMxM5KARlh hku7hu2pQ9H8ZjS93wYZ4hG2unGiMU7XpkYdqVrQ24st9rvpHBQtJX4I9P05x5GWzsqK T3qpcw0tJ1SV9aMuCFZ1B/naSkUT7u65lEiD2gjv8mjNmcUCrj4n9F+9s5+3w/WRBFWO 5Q/llC1hav0Q/ZoUZXkk7IMC2hT0R7/9bJlX4YJmPS4Nk1x9JcTpYNIHlQ7p7TYhAwd6 oX4bRmGk0O2UTNuPD47lRXO7JPUZkQPWcy1hdrN0QiXKTE/PSfce6tFMGZS9EP1NUGAK /KnA== X-Gm-Message-State: ANoB5plR/zHVgR/li/APfP0HL/8it9QXvdGCeEYRFIbqeyHtSF0OzVcU skv7spm0F62WV+12Q5m6h75hvQ== X-Google-Smtp-Source: AA0mqf7G0IhHkis17R7KEahp13i9wYGOGmhYQ7PgYOGtNq4ygFCdTa/jZGdlyCipBJ8O/77Zd7y/Bg== X-Received: by 2002:a05:6402:ea0:b0:463:a83c:e019 with SMTP id h32-20020a0564020ea000b00463a83ce019mr39357779eda.253.1669817222886; Wed, 30 Nov 2022 06:07:02 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:07:02 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 05/11] selftests: mptcp: declare var as local Date: Wed, 30 Nov 2022 15:06:27 +0100 Message-Id: <20221130140637.409926-6-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4471; i=matthieu.baerts@tessares.net; h=from:subject; bh=lUshWFmqLTSaxhy6jIUdB01u4qUlhoHgYrons8BADMM=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NozzGzy2cE3zTK8cmVfAW4GfQ6Gk8h75OQbl18 aHAzCo6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaAAKCRD2t4JPQmmgc94cD/ 4w5j2YieduhM2Ir7Q9nbuk6s10zRVFqoozqDn5HKr3y8keDSJotSnd6tkaGl1s8wRauAdWxqZ52X6q jKWBtCBElKSnFWg0iIg3wB8OcSdDqG5RFHg0Axcks7ANQvP1L/VOIl5EtJfbbRw0dPxgRqhMlgAQkx f3bKaTe/+17a7oBbF+m3ryHY/vr3EMSXsbqzOmy9IIJKi6Tfcc6Igl93ECukRmse/OkZ3jMNbxCYm3 wtejSQM8lc8AphMo8AEugMjBsiHHNIP3wOZPEfgKHJbnZpBgII4ZL5iIzO7xVCIFem41UFaa/4k0Kx ZLaf5t59dh0BnuEj1VpZMB+3TZVRbL8BNU7rNk9kPh0WVZh7NxvrZDPELAsdyWY24Xno+4mdAXZlxa V2IOnDXjGsQsmeghitZbqSQXga+BHNJbdSW+uwdRqQX5lX7eyU3/MnZMEjp8aKf/R4RDurlkoCwYEX C1/Qx4myEgVyXGKzBjOkmtJZ/dtU+N6Eyjes5V0oK2V6vngSh4WkOHPnikfxFnMNH7xmXbXjTQV9ue GgICUbBYiaYTO7uUOTssR5Qn3R4VpS/gY14soly5lELLhTgET4A26wBh/dJQwUquG7xmDDRGSGBWzv gwGf3PYUlWd+EZDAbvjqB7wnTPJyA72XWSpiEjCYsFUisIJmXhAyZFByd/sw== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Just to avoid classical Bash pitfall where variables are accidentally overridden by other functions because the proper scope has not been defined. That's also what is done in other MPTCP selftests scripts where all non local variables are defined at the beginning of the script and the others are defined with the "local" keyword. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- .../selftests/net/mptcp/mptcp_sockopt.sh | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index f74b237bcb32..1b70c0a304ce 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -22,6 +22,7 @@ add_mark_rules() local ns=$1 local m=$2 + local t for t in iptables ip6tables; do # just to debug: check we have multiple subflows connection requests ip netns exec $ns $t -A OUTPUT -p tcp --syn -m mark --mark $m -j ACCEPT @@ -36,6 +37,7 @@ add_mark_rules() init() { + local netns for netns in "$ns1" "$ns2" "$ns_sbox";do ip netns add $netns || exit $ksft_skip ip -net $netns link set lo up @@ -44,6 +46,7 @@ init() ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0 done + local i for i in `seq 1 4`; do ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$ns2" ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i @@ -73,6 +76,7 @@ init() cleanup() { + local netns for netns in "$ns1" "$ns2" "$ns_sbox"; do ip netns del $netns done @@ -103,15 +107,17 @@ check_mark() local ns=$1 local af=$2 - tables=iptables + local tables=iptables if [ $af -eq 6 ];then tables=ip6tables fi + local counters values counters=$(ip netns exec $ns $tables -v -L OUTPUT | grep DROP) values=${counters%DROP*} + local v for v in $values; do if [ $v -ne 0 ]; then echo "FAIL: got $tables $values in ns $ns , not 0 - not all expected packets marked" 1>&2 @@ -131,9 +137,9 @@ print_file_err() check_transfer() { - in=$1 - out=$2 - what=$3 + local in=$1 + local out=$2 + local what=$3 cmp "$in" "$out" > /dev/null 2>&1 if [ $? -ne 0 ] ;then @@ -156,18 +162,18 @@ is_v6() do_transfer() { - listener_ns="$1" - connector_ns="$2" - cl_proto="$3" - srv_proto="$4" - connect_addr="$5" + local listener_ns="$1" + local connector_ns="$2" + local cl_proto="$3" + local srv_proto="$4" + local connect_addr="$5" - port=12001 + local port=12001 :> "$cout" :> "$sout" - mptcp_connect="./mptcp_connect -r 20" + local mptcp_connect="./mptcp_connect -r 20" local local_addr if is_v6 "${connect_addr}"; then @@ -180,7 +186,7 @@ do_transfer() ip netns exec ${listener_ns} \ $mptcp_connect -t ${timeout_poll} -l -M 1 -p $port -s ${srv_proto} -c TIMESTAMPNS,TCPINQ \ ${local_addr} < "$sin" > "$sout" & - spid=$! + local spid=$! sleep 1 @@ -189,12 +195,12 @@ do_transfer() $mptcp_connect -t ${timeout_poll} -M 2 -p $port -s ${cl_proto} -c TIMESTAMPNS,TCPINQ \ $connect_addr < "$cin" > "$cout" & - cpid=$! + local cpid=$! wait $cpid - retc=$? + local retc=$? wait $spid - rets=$? + local rets=$? if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then echo " client exit code $retc, server $rets" 1>&2 @@ -229,9 +235,9 @@ do_transfer() make_file() { - name=$1 - who=$2 - size=$3 + local name=$1 + local who=$2 + local size=$3 dd if=/dev/urandom of="$name" bs=1024 count=$size 2> /dev/null echo -e "\nMPTCP_TEST_FILE_END_MARKER" >> "$name" @@ -264,9 +270,9 @@ do_mptcp_sockopt_tests() run_tests() { - listener_ns="$1" - connector_ns="$2" - connect_addr="$3" + local listener_ns="$1" + local connector_ns="$2" + local connect_addr="$3" local lret=0 do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} @@ -282,7 +288,7 @@ run_tests() do_tcpinq_test() { ip netns exec "$ns_sbox" ./mptcp_inq "$@" - lret=$? + local lret=$? if [ $lret -ne 0 ];then ret=$lret echo "FAIL: mptcp_inq $@" 1>&2 @@ -297,6 +303,7 @@ do_tcpinq_tests() { local lret=0 + local args for args in "-t tcp" "-r tcp"; do do_tcpinq_test $args lret=$? From patchwork Wed Nov 30 14:06:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059903 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 531B9C4332F for ; Wed, 30 Nov 2022 14:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229827AbiK3OIb (ORCPT ); Wed, 30 Nov 2022 09:08:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbiK3OHh (ORCPT ); Wed, 30 Nov 2022 09:07:37 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829747722A for ; Wed, 30 Nov 2022 06:07:07 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id e27so41586305ejc.12 for ; Wed, 30 Nov 2022 06:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jypnv7wptQURs7eFnZrKwLAnNbefpkWc9aDC2tuITf8=; b=rWIZ32Mn4YU11VZPjBYcyjpGALFr0mub2FeUmrggTQ+QArd5PjZ2OQOHNox+jJYez1 JwvJUHP4KnlgMNgld2+iUuVk2e1sGApkV2Y33JkOzyLY30lRyVCOupISgOiPqgS6MwOy FHP4DOTMxrx3BsTLsFnXL9NEtEkePZh+bfOlGqMtRm+BRg1QswDK1HyaB2DPdNWpAsE6 mjQxMLmkVDsVWSWCG/GkCPozjvZ+yUD1/DWROmDrWJoWmeeAIxFkXhM6UX1faGUk8aCc 8bqIJlZyMN7ame9ZjpyS7loSQmxTVLUvUmELdT7Pd3kC78AErumMGTm7GwlyWu34Nr4X DMKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jypnv7wptQURs7eFnZrKwLAnNbefpkWc9aDC2tuITf8=; b=fSNCjiu/AcSe5ZuYm9CdnRkrVpKhbzaokw0tHFBhczm+6g457pydZhYj16UIEgHDUJ g/SWYN5Y9ONslLMLdmbDK8szH/RurqD+I9H8XutOk+bj5o2uSGndFlnv+y+LBI3XKUo8 sF4/1+J/FR8eW/hGb9izetORVIJo6Q1ER/Hv7ZRrrwlDj1yL47C6I7QV/xTwQaa0tEDv HcOE6u4sN0ZQKRNoWp9YVpZT6V/c9ooBUFwfWXioZWQpG45C2C9j5NPVxXWR0fQfBYdJ 2quBB0ZXs2jyJ0odpGH2eRpb0Fz4K7kJSK60Pj3BjZD1NTufyC371v5CEyWaVyIxSoQY XTpg== X-Gm-Message-State: ANoB5pnlYHYjXw4VD2uDkGN3Mi2wcqnjbfczu4TibsTDaokc3D1mdjSI E7hk214fkWVxDubihDGCKCQImg== X-Google-Smtp-Source: AA0mqf7GHMCp00Y7SecKSmhD4vcmJrOgglpaXWfNNt8kKNntvyMlY67sp3ifPr/EITblAUBOA8X0ng== X-Received: by 2002:a17:906:448d:b0:7ae:37aa:6bf with SMTP id y13-20020a170906448d00b007ae37aa06bfmr51496092ejo.481.1669817224788; Wed, 30 Nov 2022 06:07:04 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:07:04 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH net-next 06/11] mptcp: add pm listener events Date: Wed, 30 Nov 2022 15:06:28 +0100 Message-Id: <20221130140637.409926-7-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5398; i=matthieu.baerts@tessares.net; h=from:subject; bh=LnmyaHIci1tYgRCMKF8BiZsWwBqNZm01jB01Gdm9oE4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NokNuPz8n5gfzPjJehB5RFek7IJw3lhjKPHQw3 5vs8XKCJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaAAKCRD2t4JPQmmgc/WWEA CBznvHePDjzNkcpqIwrlw2lL7Bs1l/G7rWbrVWfoPJnqRpYwZRlw+0yWYOYkazXeoK5jPMMSnVMLeA 9SWwQOE2I8VqZnQDarUiI1fxr9qBhP/t4V4Mams7hCLQlZ8UFu9ezJYEDP6ihkPShyOJJ+6EEssQUE fJQCHGqLDkn4Qsx/S59UY+dx8mFi6tB+nlSSdhakqnjzD1ABg5nK6wayi9A8zDUOul5fdlUNPhlja0 h8xB34UerEil6aoIaDB7iM/1iHJB5wJkS6T8k4aaCveFH4/uvWxGEzkRFbwYqWXzZRuAb+XyKIcjKo ps6e/EWE93ga5OvI0HvS2wWIfMEV5CYEYfyNMn2xBKohnljUzowX5pCDABKaulSNL/V7LScEBROrCt ntQ9cthDUVsT56DfevVXKD7+s2UYD+4/G4iysZ5u2Pjw5TO1oA1xVX+uP48VcLw+DtYCirnxtfU8WX YghSCkNaMELqV8SUkcmnUGiedlQKarv6IyVW0Oc5RV2XP08zWD0TIj886D3mr8XmzmCqk4lPzYpy03 /RWNGi8D9A+NDSNT8Aa8cGWb9yWc1+vzmOmvkNdvESVxkzfWWc4fW3P2AhiPTPzsYchWOoDdtHl69f AT9rDZC8dEhobuE9zDmis7qjxdHI1NLMoRjoNEYFrf+wgRDKrIZIbOVVSk/A== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch adds two new MPTCP netlink event types for PM listening socket create and close, named MPTCP_EVENT_LISTENER_CREATED and MPTCP_EVENT_LISTENER_CLOSED. Add a new function mptcp_event_pm_listener() to push the new events with family, port and addr to userspace. Invoke mptcp_event_pm_listener() with MPTCP_EVENT_LISTENER_CREATED in mptcp_listen() and mptcp_pm_nl_create_listen_socket(), invoke it with MPTCP_EVENT_LISTENER_CLOSED in __mptcp_close_ssk(). Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- include/uapi/linux/mptcp.h | 9 ++++++ net/mptcp/pm_netlink.c | 57 ++++++++++++++++++++++++++++++++++++++ net/mptcp/protocol.c | 3 ++ net/mptcp/protocol.h | 2 ++ 4 files changed, 71 insertions(+) diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index dfe19bf13f4c..32af2d278cb4 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -160,6 +160,12 @@ struct mptcp_info { * daddr4 | daddr6, sport, dport, backup, if_idx * [, error] * The priority of a subflow has changed. 'error' should not be set. + * + * MPTCP_EVENT_LISTENER_CREATED: family, sport, saddr4 | saddr6 + * A new PM listener is created. + * + * MPTCP_EVENT_LISTENER_CLOSED: family, sport, saddr4 | saddr6 + * A PM listener is closed. */ enum mptcp_event_type { MPTCP_EVENT_UNSPEC = 0, @@ -174,6 +180,9 @@ enum mptcp_event_type { MPTCP_EVENT_SUB_CLOSED = 11, MPTCP_EVENT_SUB_PRIORITY = 13, + + MPTCP_EVENT_LISTENER_CREATED = 15, + MPTCP_EVENT_LISTENER_CLOSED = 16, }; enum mptcp_event_attr { diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d66fbd558263..eef69d0e44ec 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1029,6 +1029,8 @@ static int mptcp_pm_nl_create_listen_socket(struct sock *sk, if (err) return err; + mptcp_event_pm_listener(ssock->sk, MPTCP_EVENT_LISTENER_CREATED); + return 0; } @@ -2152,6 +2154,58 @@ void mptcp_event_addr_announced(const struct sock *ssk, kfree_skb(skb); } +void mptcp_event_pm_listener(const struct sock *ssk, + enum mptcp_event_type event) +{ + const struct inet_sock *issk = inet_sk(ssk); + struct net *net = sock_net(ssk); + struct nlmsghdr *nlh; + struct sk_buff *skb; + + if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) + return; + + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); + if (!skb) + return; + + nlh = genlmsg_put(skb, 0, 0, &mptcp_genl_family, 0, event); + if (!nlh) + goto nla_put_failure; + + if (nla_put_u16(skb, MPTCP_ATTR_FAMILY, ssk->sk_family)) + goto nla_put_failure; + + if (nla_put_be16(skb, MPTCP_ATTR_SPORT, issk->inet_sport)) + goto nla_put_failure; + + switch (ssk->sk_family) { + case AF_INET: + if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) + goto nla_put_failure; + break; +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + case AF_INET6: { + const struct ipv6_pinfo *np = inet6_sk(ssk); + + if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &np->saddr)) + goto nla_put_failure; + break; + } +#endif + default: + WARN_ON_ONCE(1); + goto nla_put_failure; + } + + genlmsg_end(skb, nlh); + mptcp_nl_mcast_send(net, skb, GFP_KERNEL); + return; + +nla_put_failure: + kfree_skb(skb); +} + void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, const struct sock *ssk, gfp_t gfp) { @@ -2197,6 +2251,9 @@ void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, if (mptcp_event_sub_closed(skb, msk, ssk) < 0) goto nla_put_failure; break; + case MPTCP_EVENT_LISTENER_CREATED: + case MPTCP_EVENT_LISTENER_CLOSED: + break; } genlmsg_end(skb, nlh); diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index b0d387be500a..f6f93957275b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2355,6 +2355,7 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, tcp_set_state(ssk, TCP_CLOSE); mptcp_subflow_queue_clean(ssk); inet_csk_listen_stop(ssk); + mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CLOSED); } __tcp_close(ssk, 0); @@ -3647,6 +3648,8 @@ static int mptcp_listen(struct socket *sock, int backlog) if (!err) mptcp_copy_inaddrs(sock->sk, ssock->sk); + mptcp_event_pm_listener(ssock->sk, MPTCP_EVENT_LISTENER_CREATED); + unlock: release_sock(sock->sk); return err; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 8b4379a2cd85..955fb3d88eb3 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -839,6 +839,8 @@ void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, const struct sock *ssk, gfp_t gfp); void mptcp_event_addr_announced(const struct sock *ssk, const struct mptcp_addr_info *info); void mptcp_event_addr_removed(const struct mptcp_sock *msk, u8 id); +void mptcp_event_pm_listener(const struct sock *ssk, + enum mptcp_event_type event); bool mptcp_userspace_pm_active(const struct mptcp_sock *msk); void mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, From patchwork Wed Nov 30 14:06:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059904 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D0DAC352A1 for ; Wed, 30 Nov 2022 14:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbiK3OIi (ORCPT ); Wed, 30 Nov 2022 09:08:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229829AbiK3OHh (ORCPT ); Wed, 30 Nov 2022 09:07:37 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DF798BD16 for ; Wed, 30 Nov 2022 06:07:08 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id bj12so41518563ejb.13 for ; Wed, 30 Nov 2022 06:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w8+9TtQhJTeugjJt6JDxh1bHQ8477mWDIxdOTyt8gMw=; b=4oflt4ubSUqJSREur2/9AlJll73FxY6sPeNoi/8wc7ocqzr/u8Cl0H/oPniO8evrYC 7SEqf9JNI9HBQYpZwbpGd6PgvYJaZ7lzjqGVZw/3jk286YmCOgvsFOi46eTOHUKRwj2g c/gsolXbaAlW2aAjBzQRmwIWjHrC5P3LGVNYKXD+3ARG9nokvofk7/EHXSxY3LKrYCq8 E49GiNfIMAwvMevvQQdi98im6TmTo2/aT1k8CUTo3T8HzBFvDX5Veu49i6PIdNgHmps0 SF6LShcVe6xUAYMKcqNWatomleAHfran5j/kWwOqpGwt54vpuo30sd0Hi8kVLrplmey2 jX2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w8+9TtQhJTeugjJt6JDxh1bHQ8477mWDIxdOTyt8gMw=; b=QzuABcgCfTzTc/vI+sfgTIqQO0Vs8HQJMCkTYcsFRbDxHq0jm2hQLDFDsJL19kLMPN edacmtKfY4Zt/Dqj9fYVioX3itubUL/mFx84rFlKjtufiB45vCvwKyulXglWPjzBMCgq jzeEJesmOMtdhWw7wLC83xXMtw9tDuPZraOkYHtWDs9TTZUDhCrlTRU3q0kRR2Bwlumt NNSWORCZMteSzQ2owGaev4nn8cZlRi7xTAqw63F11srCyK+u6bTWuvqRo3MCoMUBLuUO Q81uwCZAhsiEFeV5lQXUbm4XFj4TRsSdw3ThTuP7LgW48Cg/rIHIx2XnoC2uERCoSeFg d4Mw== X-Gm-Message-State: ANoB5pnNQjjY73DK4rAruXTV/CbNeIJErgIw2pe3M66URx10C4wb6Pbo Ym0peWY4yEUhw3qQMIQWooAgqs/pUw20qz310ng= X-Google-Smtp-Source: AA0mqf6xQFkbPndD0+0xMKNKfhBREvCTpy6IDc9dr5EQT+7HRW5hZ+Pa9H9qnGWSWNlwoac4ZVY9Aw== X-Received: by 2002:a17:906:1106:b0:7be:833e:d242 with SMTP id h6-20020a170906110600b007be833ed242mr16211181eja.405.1669817226587; Wed, 30 Nov 2022 06:07:06 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:07:05 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 07/11] selftests: mptcp: enhance userspace pm tests Date: Wed, 30 Nov 2022 15:06:29 +0100 Message-Id: <20221130140637.409926-8-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2625; i=matthieu.baerts@tessares.net; h=from:subject; bh=Uj60AGilfzPETmXERWWoIIHskkAhbbWouLnBIXu+gN4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NoIX0vsxi6qa6Jw9EvRJSFj6RKVVDVxl079pit dpz244SJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaAAKCRD2t4JPQmmgc+QuD/ 4vEfMtrQx3rmlLZrWdN7G+a5I4u1HKqoMgVD/K8hnMq+rbBZsSxkXv0i13De/SUMveauxDcN+h0OGn M9bWZkwrt7Vbd+YKt1Eajj+wYl5fN9RHqKXx3GhciodaTxc71HCEZwUDviloUYXzJjjDZzk5EnzM85 pEyDiRqsFHKfX2YcpXhdvk2HtGoLfFTXI1BzEpVyQnrcOimfiIPPI6iEDWvTleaeK7rug/FrOV1K5f HL0btU98dEPfIAYfCaU1gem2Qf9OuRP155KNU0vwTwcnIb2Iv3rmBi6cPW83uz9wbRIfu+bQqvhRWC hvWA6fKih0LTqlLAEB9H1fWPWlMXFQk9xQOMqF2a3FYp4M6I9jZSYB34yeDRO4z9gEYZi4M1Rkv+Zq c5EOxvzuM7t8IBWVUnoUdfWqC7kFFr+DpYdstkHwL427+m741j8mylCCJeD2rcnzdWvaOW00J7B5NW I2Bg+WsKmZoFU3p57XnpTtQMm90/x0O4EkO5hlEyaSyWSkdQuJmVZ3j0cpHsYNKfgssrvRGFnoDg1A 0IpSJbkwPFpjFtGqWW0awE74dAbjF2yaBJ8TdMdNFJHS8qpmt/w2DSYZlrMo2S6FFW4lzNR0QqCH8t dHY/qK32CqLtp1lbDrtl4UmBe+fPYE+e1J2nJpXdPRNYdxQGm9cXvTIzbQFg== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang Some userspace pm tests failed since pm listener events have been added. Now MPTCP_EVENT_LISTENER_CREATED event becomes the first item in the events list like this: type:15,family:2,sport:10006,saddr4:0.0.0.0 type:1,token:3701282876,server_side:1,family:2,saddr4:10.0.1.1,... And no token value in this MPTCP_EVENT_LISTENER_CREATED event. This patch fixes this by specifying the type 1 item to search for token values. Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++- tools/testing/selftests/net/mptcp/userspace_pm.sh | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 2a402b3b771f..f10ef65a7009 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -830,7 +830,8 @@ do_transfer() if [ $userspace_pm -eq 0 ]; then pm_nl_add_endpoint $ns1 $addr flags signal else - tk=$(sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns1") + tk=$(grep "type:1," "$evts_ns1" | + sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q') ip netns exec ${listener_ns} ./pm_nl_ctl ann $addr token $tk id $id sleep 1 ip netns exec ${listener_ns} ./pm_nl_ctl rem token $tk id $id diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 5dfc3ee74b98..08a88ea47a29 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -172,9 +172,10 @@ make_connection() client_serverside=$(sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q'\ "$client_evts") kill_wait $server_evts_pid - server_token=$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts") - server_serverside=$(sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q'\ - "$server_evts") + server_token=$(grep "type:1," "$server_evts" | + sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q') + server_serverside=$(grep "type:1," "$server_evts" | + sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q') rm -f "$client_evts" "$server_evts" "$file" if [ "$client_token" != "" ] && [ "$server_token" != "" ] && [ "$client_serverside" = 0 ] && From patchwork Wed Nov 30 14:06:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059905 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 278B9C433FE for ; Wed, 30 Nov 2022 14:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbiK3OIr (ORCPT ); Wed, 30 Nov 2022 09:08:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229834AbiK3OHh (ORCPT ); Wed, 30 Nov 2022 09:07:37 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6FB38BD19 for ; Wed, 30 Nov 2022 06:07:09 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id a16so2704305edb.9 for ; Wed, 30 Nov 2022 06:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mrnGr1gkWDPzCdVnTO5Oj9Ll5rKnYAEwA2ORBCcWSm4=; b=P+WcvqQjAM6KwFqHF7sLEcO0W54sC+NQ38Lyd4ymCJlD0Ns7DBTfxzJ0wX9OHkM5aY PHlqvWmjcYKzjJ4yRDefk5uwrfEZyHsz16QAL797UDlxA0gDsKySoq7y5flP4Fwnfv+0 e2/4wYIz1ia1w62FTW5/4kydUHLowlQCvzI+TNKGcNqfBNk7Gzg4FpLSTiKzNJpIg5My HwcqTEkB2OheDdo6onaYJz134QHHA1e3D/lGkkNSq446Xm4mfZ3d0/04qGDbn14t7Cg3 y3dt5xNg/y7g53ydL7ljQuXoVsHVrUKpjWaZvxjv16YR/g7CykTJ3blvxeB7NaNVVlQZ gEug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mrnGr1gkWDPzCdVnTO5Oj9Ll5rKnYAEwA2ORBCcWSm4=; b=KfAiBeHsM3KNk6klVbakz6Yt8fQz/KDV+0UbMOCK3pnNC3YtgO2GUIUD3VtOdSlWEH LWARX48DVz5EmDSt7kYzEKa8tiUUHLssaUe/ySHdX9bQPdXxRytZSPao/11Zkq6PLdcr VmhEtyq6mzUmYlAGbOhuQ95EbRLcDa4s3XriJBVVZFzHrfrQlmUmlR8f6/E/QAHnIk+3 SYDZsz3vrimZvatUXdWS+o3By3sGQVXGSVYcNwpysKYX0SAPmtzceWBMfBTGHqm0/gdk 3UXL7ulCgxCZXhPi6GKrHqXW2cCXLxA0fL/r0ycOtjJ/oy85bauMDmhD0RD9y7vqGxYi SpUQ== X-Gm-Message-State: ANoB5pkX0AJcgXPZL1n4WYVEvsIX4ox99+8wyeL4GUzgDehxktDYT3z8 bYWMuUzZRDnFzVwvBEntNvHJYQ== X-Google-Smtp-Source: AA0mqf5vpdclCuaS9lKTr4melk2oy8sb8GRO7RHf/ED85q/Ss7q2eNgWws6OUjNGz/oRau+ItdZH3Q== X-Received: by 2002:a05:6402:f1c:b0:46a:b1a9:c34e with SMTP id i28-20020a0564020f1c00b0046ab1a9c34emr24734189eda.212.1669817228215; Wed, 30 Nov 2022 06:07:08 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:07:07 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 08/11] selftests: mptcp: make evts global in userspace_pm Date: Wed, 30 Nov 2022 15:06:30 +0100 Message-Id: <20221130140637.409926-9-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=22947; i=matthieu.baerts@tessares.net; h=from:subject; bh=74f2sVkcyyZrceQDN5eAJcHPlf9GnlTPNPYe49lAAK8=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NoY+FUlXH7TR+COsAZpqEEQXL+TnKWYTK/5Jem qWu2SfKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaAAKCRD2t4JPQmmgc6nGEA Dw0PtJSxMXMfjdXTs7wGhit4XJJzGVyTQZDac1+CE9z34zeaJ5KaWQsX5NtKugQQaiV4pLmTZV1Qc0 NYIahHZJGKiPq9BZpFay/J7E96Q5vKg/Yx2xjQIufzE7cX8iO2XE4hasFrplQZ5DLzyoEkBOXPPR9s 4TNrcGcjf+HU/2CpttMbINaZqLXO+hmVgvrNRhEOrhzSd15MxVP0OxhwY7Q+0Td5WDFA/N2WNvCaci u3YVjJgIiX0JxZg825n2UxamFHN8VTDNV//uJQJMObDJ0i6eTjQU8WZ1bJz5YChVGwraJ+9rgIMtVs e/aay8tTQU6vIkxBoA9iXj0FOXKXWT2Khhc67T5zCgTLoC+cM1Fo7nBExOzhBGj94kGD6wrlpXOxET +c0KFkeIncjeZkqunaaBNck64vWU8LzSii/cn/opIEtqGdGNzcYLN4i08qx2LNBR7WCg3YxtO0Febf HdNcf0ienSjF6pJbC7eNscJPNUPl7IwvS7yb8XaR3UhSH6npUWw9+P3HfiHC6UN2SuYg+a2rpfwqAr DGUW/63bzOMfdtlYkR2o39iQx8AV8eM1k1plt6ODcHUADnxkugDPBKX8qeh4CS8FB9vJlro2kq+DJV HQMKbjMTw62o6AnjnROLDPweWqy6ckgqiNCFPaMgiQkY/NsyYuq4WO4rk25g== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch makes server_evts and client_evts global in userspace_pm.sh, then these two variables could be used in test_announce(), test_remove() and test_subflows(). The local variable 'evts' in these three functions then could be dropped. Also move local variable 'file' as a global one. Suggested-by: Paolo Abeni Signed-off-by: Geliang Tang Acked-by: Paolo Abeni Signed-off-by: Matthieu Baerts --- .../selftests/net/mptcp/userspace_pm.sh | 213 ++++++++---------- 1 file changed, 93 insertions(+), 120 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 08a88ea47a29..91d6f30e2fe4 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -15,7 +15,11 @@ SUB_CLOSED=11 # MPTCP_EVENT_SUB_CLOSED AF_INET=2 AF_INET6=10 -evts_pid=0 +file="" +server_evts="" +client_evts="" +server_evts_pid=0 +client_evts_pid=0 client4_pid=0 server4_pid=0 client6_pid=0 @@ -47,7 +51,7 @@ cleanup() { echo "cleanup" - rm -rf $file + rm -rf $file $client_evts $server_evts # Terminate the MPTCP connection and related processes if [ $client4_pid -ne 0 ]; then @@ -62,8 +66,11 @@ cleanup() if [ $server6_pid -ne 0 ]; then kill_wait $server6_pid fi - if [ $evts_pid -ne 0 ]; then - kill_wait $evts_pid + if [ $server_evts_pid -ne 0 ]; then + kill_wait $server_evts_pid + fi + if [ $client_evts_pid -ne 0 ]; then + kill_wait $client_evts_pid fi local netns for netns in "$ns1" "$ns2" ;do @@ -113,8 +120,9 @@ make_file() make_connection() { - local file - file=$(mktemp) + if [ -z "$file" ]; then + file=$(mktemp) + fi make_file "$file" "client" local is_v6=$1 @@ -132,16 +140,24 @@ make_connection() # Capture netlink events over the two network namespaces running # the MPTCP client and server - local client_evts - client_evts=$(mktemp) + if [ -z "$client_evts" ]; then + client_evts=$(mktemp) + fi :>"$client_evts" + if [ $client_evts_pid -ne 0 ]; then + kill_wait $client_evts_pid + fi ip netns exec "$ns2" ./pm_nl_ctl events >> "$client_evts" 2>&1 & - local client_evts_pid=$! - local server_evts - server_evts=$(mktemp) + client_evts_pid=$! + if [ -z "$server_evts" ]; then + server_evts=$(mktemp) + fi :>"$server_evts" + if [ $server_evts_pid -ne 0 ]; then + kill_wait $server_evts_pid + fi ip netns exec "$ns1" ./pm_nl_ctl events >> "$server_evts" 2>&1 & - local server_evts_pid=$! + server_evts_pid=$! sleep 0.5 # Run the server @@ -159,7 +175,6 @@ make_connection() sleep 1 # Capture client/server attributes from MPTCP connection netlink events - kill_wait $client_evts_pid local client_token local client_port @@ -171,12 +186,10 @@ make_connection() client_port=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts") client_serverside=$(sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q'\ "$client_evts") - kill_wait $server_evts_pid server_token=$(grep "type:1," "$server_evts" | sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q') server_serverside=$(grep "type:1," "$server_evts" | sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q') - rm -f "$client_evts" "$server_evts" "$file" if [ "$client_token" != "" ] && [ "$server_token" != "" ] && [ "$client_serverside" = 0 ] && [ "$server_serverside" = 1 ] @@ -240,13 +253,8 @@ verify_announce_event() test_announce() { - local evts - evts=$(mktemp) # Capture events on the network namespace running the server - :>"$evts" - ip netns exec "$ns1" ./pm_nl_ctl events >> "$evts" 2>&1 & - evts_pid=$! - sleep 0.5 + :>"$server_evts" # ADD_ADDR using an invalid token should result in no action local invalid_token=$(( client4_token - 1)) @@ -254,7 +262,7 @@ test_announce() $client_addr_id dev ns2eth1 > /dev/null 2>&1 local type - type=$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + type=$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts") stdbuf -o0 -e0 printf "ADD_ADDR 10.0.2.2 (ns2) => ns1, invalid token \t\t" if [ "$type" = "" ] then @@ -265,71 +273,63 @@ test_announce() fi # ADD_ADDR from the client to server machine reusing the subflow port - :>"$evts" + :>"$server_evts" ip netns exec "$ns2"\ ./pm_nl_ctl ann 10.0.2.2 token "$client4_token" id $client_addr_id dev\ ns2eth1 > /dev/null 2>&1 stdbuf -o0 -e0 printf "ADD_ADDR id:%d 10.0.2.2 (ns2) => ns1, reuse port \t\t" $client_addr_id sleep 0.5 - verify_announce_event "$evts" "$ANNOUNCED" "$server4_token" "10.0.2.2" "$client_addr_id"\ + verify_announce_event $server_evts $ANNOUNCED $server4_token "10.0.2.2" $client_addr_id \ "$client4_port" # ADD_ADDR6 from the client to server machine reusing the subflow port - :>"$evts" + :>"$server_evts" ip netns exec "$ns2" ./pm_nl_ctl ann\ dead:beef:2::2 token "$client6_token" id $client_addr_id dev ns2eth1 > /dev/null 2>&1 stdbuf -o0 -e0 printf "ADD_ADDR6 id:%d dead:beef:2::2 (ns2) => ns1, reuse port\t\t" $client_addr_id sleep 0.5 - verify_announce_event "$evts" "$ANNOUNCED" "$server6_token" "dead:beef:2::2"\ + verify_announce_event "$server_evts" "$ANNOUNCED" "$server6_token" "dead:beef:2::2"\ "$client_addr_id" "$client6_port" "v6" # ADD_ADDR from the client to server machine using a new port - :>"$evts" + :>"$server_evts" client_addr_id=$((client_addr_id+1)) ip netns exec "$ns2" ./pm_nl_ctl ann 10.0.2.2 token "$client4_token" id\ $client_addr_id dev ns2eth1 port $new4_port > /dev/null 2>&1 stdbuf -o0 -e0 printf "ADD_ADDR id:%d 10.0.2.2 (ns2) => ns1, new port \t\t\t" $client_addr_id sleep 0.5 - verify_announce_event "$evts" "$ANNOUNCED" "$server4_token" "10.0.2.2"\ + verify_announce_event "$server_evts" "$ANNOUNCED" "$server4_token" "10.0.2.2"\ "$client_addr_id" "$new4_port" - kill_wait $evts_pid - # Capture events on the network namespace running the client - :>"$evts" - ip netns exec "$ns2" ./pm_nl_ctl events >> "$evts" 2>&1 & - evts_pid=$! - sleep 0.5 + :>"$client_evts" # ADD_ADDR from the server to client machine reusing the subflow port ip netns exec "$ns1" ./pm_nl_ctl ann 10.0.2.1 token "$server4_token" id\ $server_addr_id dev ns1eth2 > /dev/null 2>&1 stdbuf -o0 -e0 printf "ADD_ADDR id:%d 10.0.2.1 (ns1) => ns2, reuse port \t\t" $server_addr_id sleep 0.5 - verify_announce_event "$evts" "$ANNOUNCED" "$client4_token" "10.0.2.1"\ + verify_announce_event "$client_evts" "$ANNOUNCED" "$client4_token" "10.0.2.1"\ "$server_addr_id" "$app4_port" # ADD_ADDR6 from the server to client machine reusing the subflow port - :>"$evts" + :>"$client_evts" ip netns exec "$ns1" ./pm_nl_ctl ann dead:beef:2::1 token "$server6_token" id\ $server_addr_id dev ns1eth2 > /dev/null 2>&1 stdbuf -o0 -e0 printf "ADD_ADDR6 id:%d dead:beef:2::1 (ns1) => ns2, reuse port\t\t" $server_addr_id sleep 0.5 - verify_announce_event "$evts" "$ANNOUNCED" "$client6_token" "dead:beef:2::1"\ + verify_announce_event "$client_evts" "$ANNOUNCED" "$client6_token" "dead:beef:2::1"\ "$server_addr_id" "$app6_port" "v6" # ADD_ADDR from the server to client machine using a new port - :>"$evts" + :>"$client_evts" server_addr_id=$((server_addr_id+1)) ip netns exec "$ns1" ./pm_nl_ctl ann 10.0.2.1 token "$server4_token" id\ $server_addr_id dev ns1eth2 port $new4_port > /dev/null 2>&1 stdbuf -o0 -e0 printf "ADD_ADDR id:%d 10.0.2.1 (ns1) => ns2, new port \t\t\t" $server_addr_id sleep 0.5 - verify_announce_event "$evts" "$ANNOUNCED" "$client4_token" "10.0.2.1"\ + verify_announce_event "$client_evts" "$ANNOUNCED" "$client4_token" "10.0.2.1"\ "$server_addr_id" "$new4_port" - - kill_wait $evts_pid - rm -f "$evts" } verify_remove_event() @@ -357,14 +357,8 @@ verify_remove_event() test_remove() { - local evts - evts=$(mktemp) - # Capture events on the network namespace running the server - :>"$evts" - ip netns exec "$ns1" ./pm_nl_ctl events >> "$evts" 2>&1 & - evts_pid=$! - sleep 0.5 + :>"$server_evts" # RM_ADDR using an invalid token should result in no action local invalid_token=$(( client4_token - 1 )) @@ -373,7 +367,7 @@ test_remove() stdbuf -o0 -e0 printf "RM_ADDR id:%d ns2 => ns1, invalid token \t"\ $client_addr_id local type - type=$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + type=$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts") if [ "$type" = "" ] then stdbuf -o0 -e0 printf "[OK]\n" @@ -387,7 +381,7 @@ test_remove() $invalid_id > /dev/null 2>&1 stdbuf -o0 -e0 printf "RM_ADDR id:%d ns2 => ns1, invalid id \t"\ $invalid_id - type=$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + type=$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts") if [ "$type" = "" ] then stdbuf -o0 -e0 printf "[OK]\n" @@ -396,40 +390,35 @@ test_remove() fi # RM_ADDR from the client to server machine - :>"$evts" + :>"$server_evts" ip netns exec "$ns2" ./pm_nl_ctl rem token "$client4_token" id\ $client_addr_id > /dev/null 2>&1 stdbuf -o0 -e0 printf "RM_ADDR id:%d ns2 => ns1 \t"\ $client_addr_id sleep 0.5 - verify_remove_event "$evts" "$REMOVED" "$server4_token" "$client_addr_id" + verify_remove_event "$server_evts" "$REMOVED" "$server4_token" "$client_addr_id" # RM_ADDR from the client to server machine - :>"$evts" + :>"$server_evts" client_addr_id=$(( client_addr_id - 1 )) ip netns exec "$ns2" ./pm_nl_ctl rem token "$client4_token" id\ $client_addr_id > /dev/null 2>&1 stdbuf -o0 -e0 printf "RM_ADDR id:%d ns2 => ns1 \t"\ $client_addr_id sleep 0.5 - verify_remove_event "$evts" "$REMOVED" "$server4_token" "$client_addr_id" + verify_remove_event "$server_evts" "$REMOVED" "$server4_token" "$client_addr_id" # RM_ADDR6 from the client to server machine - :>"$evts" + :>"$server_evts" ip netns exec "$ns2" ./pm_nl_ctl rem token "$client6_token" id\ $client_addr_id > /dev/null 2>&1 stdbuf -o0 -e0 printf "RM_ADDR6 id:%d ns2 => ns1 \t"\ $client_addr_id sleep 0.5 - verify_remove_event "$evts" "$REMOVED" "$server6_token" "$client_addr_id" - - kill_wait $evts_pid + verify_remove_event "$server_evts" "$REMOVED" "$server6_token" "$client_addr_id" # Capture events on the network namespace running the client - :>"$evts" - ip netns exec "$ns2" ./pm_nl_ctl events >> "$evts" 2>&1 & - evts_pid=$! - sleep 0.5 + :>"$client_evts" # RM_ADDR from the server to client machine ip netns exec "$ns1" ./pm_nl_ctl rem token "$server4_token" id\ @@ -437,27 +426,24 @@ test_remove() stdbuf -o0 -e0 printf "RM_ADDR id:%d ns1 => ns2 \t"\ $server_addr_id sleep 0.5 - verify_remove_event "$evts" "$REMOVED" "$client4_token" "$server_addr_id" + verify_remove_event "$client_evts" "$REMOVED" "$client4_token" "$server_addr_id" # RM_ADDR from the server to client machine - :>"$evts" + :>"$client_evts" server_addr_id=$(( server_addr_id - 1 )) ip netns exec "$ns1" ./pm_nl_ctl rem token "$server4_token" id\ $server_addr_id > /dev/null 2>&1 stdbuf -o0 -e0 printf "RM_ADDR id:%d ns1 => ns2 \t" $server_addr_id sleep 0.5 - verify_remove_event "$evts" "$REMOVED" "$client4_token" "$server_addr_id" + verify_remove_event "$client_evts" "$REMOVED" "$client4_token" "$server_addr_id" # RM_ADDR6 from the server to client machine - :>"$evts" + :>"$client_evts" ip netns exec "$ns1" ./pm_nl_ctl rem token "$server6_token" id\ $server_addr_id > /dev/null 2>&1 stdbuf -o0 -e0 printf "RM_ADDR6 id:%d ns1 => ns2 \t" $server_addr_id sleep 0.5 - verify_remove_event "$evts" "$REMOVED" "$client6_token" "$server_addr_id" - - kill_wait $evts_pid - rm -f "$evts" + verify_remove_event "$client_evts" "$REMOVED" "$client6_token" "$server_addr_id" } verify_subflow_events() @@ -533,13 +519,8 @@ verify_subflow_events() test_subflows() { - local evts - evts=$(mktemp) # Capture events on the network namespace running the server - :>"$evts" - ip netns exec "$ns1" ./pm_nl_ctl events >> "$evts" 2>&1 & - evts_pid=$! - sleep 0.5 + :>"$server_evts" # Attempt to add a listener at 10.0.2.2: ip netns exec "$ns2" ./pm_nl_ctl listen 10.0.2.2\ @@ -552,25 +533,25 @@ test_subflows() sleep 0.5 # CREATE_SUBFLOW from server to client machine - :>"$evts" + :>"$server_evts" ip netns exec "$ns1" ./pm_nl_ctl csf lip 10.0.2.1 lid 23 rip 10.0.2.2\ rport "$client4_port" token "$server4_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_ESTABLISHED" "$server4_token" "$AF_INET" "10.0.2.1"\ + verify_subflow_events $server_evts $SUB_ESTABLISHED $server4_token $AF_INET "10.0.2.1" \ "10.0.2.2" "$client4_port" "23" "$client_addr_id" "ns1" "ns2" # Delete the listener from the client ns, if one was created kill_wait $listener_pid local sport - sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts") # DESTROY_SUBFLOW from server to client machine - :>"$evts" + :>"$server_evts" ip netns exec "$ns1" ./pm_nl_ctl dsf lip 10.0.2.1 lport "$sport" rip 10.0.2.2 rport\ "$client4_port" token "$server4_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_CLOSED" "$server4_token" "$AF_INET" "10.0.2.1"\ + verify_subflow_events "$server_evts" "$SUB_CLOSED" "$server4_token" "$AF_INET" "10.0.2.1"\ "10.0.2.2" "$client4_port" "23" "$client_addr_id" "ns1" "ns2" # RM_ADDR from client to server machine @@ -584,31 +565,31 @@ test_subflows() listener_pid=$! # ADD_ADDR6 from client to server machine reusing the subflow port - :>"$evts" + :>"$server_evts" ip netns exec "$ns2" ./pm_nl_ctl ann dead:beef:2::2 token "$client6_token" id\ $client_addr_id > /dev/null 2>&1 sleep 0.5 # CREATE_SUBFLOW6 from server to client machine - :>"$evts" + :>"$server_evts" ip netns exec "$ns1" ./pm_nl_ctl csf lip dead:beef:2::1 lid 23 rip\ dead:beef:2::2 rport "$client6_port" token "$server6_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_ESTABLISHED" "$server6_token" "$AF_INET6"\ + verify_subflow_events "$server_evts" "$SUB_ESTABLISHED" "$server6_token" "$AF_INET6"\ "dead:beef:2::1" "dead:beef:2::2" "$client6_port" "23"\ "$client_addr_id" "ns1" "ns2" # Delete the listener from the client ns, if one was created kill_wait $listener_pid - sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts") # DESTROY_SUBFLOW6 from server to client machine - :>"$evts" + :>"$server_evts" ip netns exec "$ns1" ./pm_nl_ctl dsf lip dead:beef:2::1 lport "$sport" rip\ dead:beef:2::2 rport "$client6_port" token "$server6_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_CLOSED" "$server6_token" "$AF_INET6"\ + verify_subflow_events "$server_evts" "$SUB_CLOSED" "$server6_token" "$AF_INET6"\ "dead:beef:2::1" "dead:beef:2::2" "$client6_port" "23"\ "$client_addr_id" "ns1" "ns2" @@ -623,44 +604,39 @@ test_subflows() listener_pid=$! # ADD_ADDR from client to server machine using a new port - :>"$evts" + :>"$server_evts" ip netns exec "$ns2" ./pm_nl_ctl ann 10.0.2.2 token "$client4_token" id\ $client_addr_id port $new4_port > /dev/null 2>&1 sleep 0.5 # CREATE_SUBFLOW from server to client machine - :>"$evts" + :>"$server_evts" ip netns exec "$ns1" ./pm_nl_ctl csf lip 10.0.2.1 lid 23 rip 10.0.2.2 rport\ $new4_port token "$server4_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_ESTABLISHED" "$server4_token" "$AF_INET"\ + verify_subflow_events "$server_evts" "$SUB_ESTABLISHED" "$server4_token" "$AF_INET"\ "10.0.2.1" "10.0.2.2" "$new4_port" "23"\ "$client_addr_id" "ns1" "ns2" # Delete the listener from the client ns, if one was created kill_wait $listener_pid - sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts") # DESTROY_SUBFLOW from server to client machine - :>"$evts" + :>"$server_evts" ip netns exec "$ns1" ./pm_nl_ctl dsf lip 10.0.2.1 lport "$sport" rip 10.0.2.2 rport\ $new4_port token "$server4_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_CLOSED" "$server4_token" "$AF_INET" "10.0.2.1"\ + verify_subflow_events "$server_evts" "$SUB_CLOSED" "$server4_token" "$AF_INET" "10.0.2.1"\ "10.0.2.2" "$new4_port" "23" "$client_addr_id" "ns1" "ns2" # RM_ADDR from client to server machine ip netns exec "$ns2" ./pm_nl_ctl rem id $client_addr_id token\ "$client4_token" > /dev/null 2>&1 - kill_wait $evts_pid - # Capture events on the network namespace running the client - :>"$evts" - ip netns exec "$ns2" ./pm_nl_ctl events >> "$evts" 2>&1 & - evts_pid=$! - sleep 0.5 + :>"$client_evts" # Attempt to add a listener at 10.0.2.1: ip netns exec "$ns1" ./pm_nl_ctl listen 10.0.2.1\ @@ -673,24 +649,24 @@ test_subflows() sleep 0.5 # CREATE_SUBFLOW from client to server machine - :>"$evts" + :>"$client_evts" ip netns exec "$ns2" ./pm_nl_ctl csf lip 10.0.2.2 lid 23 rip 10.0.2.1 rport\ $app4_port token "$client4_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_ESTABLISHED" "$client4_token" "$AF_INET" "10.0.2.2"\ + verify_subflow_events $client_evts $SUB_ESTABLISHED $client4_token $AF_INET "10.0.2.2"\ "10.0.2.1" "$app4_port" "23" "$server_addr_id" "ns2" "ns1" # Delete the listener from the server ns, if one was created kill_wait $listener_pid - sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts") # DESTROY_SUBFLOW from client to server machine - :>"$evts" + :>"$client_evts" ip netns exec "$ns2" ./pm_nl_ctl dsf lip 10.0.2.2 lport "$sport" rip 10.0.2.1 rport\ $app4_port token "$client4_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_CLOSED" "$client4_token" "$AF_INET" "10.0.2.2"\ + verify_subflow_events "$client_evts" "$SUB_CLOSED" "$client4_token" "$AF_INET" "10.0.2.2"\ "10.0.2.1" "$app4_port" "23" "$server_addr_id" "ns2" "ns1" # RM_ADDR from server to client machine @@ -704,17 +680,17 @@ test_subflows() listener_pid=$! # ADD_ADDR6 from server to client machine reusing the subflow port - :>"$evts" + :>"$client_evts" ip netns exec "$ns1" ./pm_nl_ctl ann dead:beef:2::1 token "$server6_token" id\ $server_addr_id > /dev/null 2>&1 sleep 0.5 # CREATE_SUBFLOW6 from client to server machine - :>"$evts" + :>"$client_evts" ip netns exec "$ns2" ./pm_nl_ctl csf lip dead:beef:2::2 lid 23 rip\ dead:beef:2::1 rport $app6_port token "$client6_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_ESTABLISHED" "$client6_token"\ + verify_subflow_events "$client_evts" "$SUB_ESTABLISHED" "$client6_token"\ "$AF_INET6" "dead:beef:2::2"\ "dead:beef:2::1" "$app6_port" "23"\ "$server_addr_id" "ns2" "ns1" @@ -722,14 +698,14 @@ test_subflows() # Delete the listener from the server ns, if one was created kill_wait $listener_pid - sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts") # DESTROY_SUBFLOW6 from client to server machine - :>"$evts" + :>"$client_evts" ip netns exec "$ns2" ./pm_nl_ctl dsf lip dead:beef:2::2 lport "$sport" rip\ dead:beef:2::1 rport $app6_port token "$client6_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_CLOSED" "$client6_token" "$AF_INET6" "dead:beef:2::2"\ + verify_subflow_events $client_evts $SUB_CLOSED $client6_token $AF_INET6 "dead:beef:2::2"\ "dead:beef:2::1" "$app6_port" "23" "$server_addr_id" "ns2" "ns1" # RM_ADDR6 from server to client machine @@ -743,38 +719,35 @@ test_subflows() listener_pid=$! # ADD_ADDR from server to client machine using a new port - :>"$evts" + :>"$client_evts" ip netns exec "$ns1" ./pm_nl_ctl ann 10.0.2.1 token "$server4_token" id\ $server_addr_id port $new4_port > /dev/null 2>&1 sleep 0.5 # CREATE_SUBFLOW from client to server machine - :>"$evts" + :>"$client_evts" ip netns exec "$ns2" ./pm_nl_ctl csf lip 10.0.2.2 lid 23 rip 10.0.2.1 rport\ $new4_port token "$client4_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_ESTABLISHED" "$client4_token" "$AF_INET"\ + verify_subflow_events "$client_evts" "$SUB_ESTABLISHED" "$client4_token" "$AF_INET"\ "10.0.2.2" "10.0.2.1" "$new4_port" "23" "$server_addr_id" "ns2" "ns1" # Delete the listener from the server ns, if one was created kill_wait $listener_pid - sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts") + sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts") # DESTROY_SUBFLOW from client to server machine - :>"$evts" + :>"$client_evts" ip netns exec "$ns2" ./pm_nl_ctl dsf lip 10.0.2.2 lport "$sport" rip 10.0.2.1 rport\ $new4_port token "$client4_token" > /dev/null 2>&1 sleep 0.5 - verify_subflow_events "$evts" "$SUB_CLOSED" "$client4_token" "$AF_INET" "10.0.2.2"\ + verify_subflow_events "$client_evts" "$SUB_CLOSED" "$client4_token" "$AF_INET" "10.0.2.2"\ "10.0.2.1" "$new4_port" "23" "$server_addr_id" "ns2" "ns1" # RM_ADDR from server to client machine ip netns exec "$ns1" ./pm_nl_ctl rem id $server_addr_id token\ "$server4_token" > /dev/null 2>&1 - - kill_wait $evts_pid - rm -f "$evts" } test_prio() From patchwork Wed Nov 30 14:06:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059906 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1677C4332F for ; Wed, 30 Nov 2022 14:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229783AbiK3OIt (ORCPT ); Wed, 30 Nov 2022 09:08:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbiK3OHk (ORCPT ); Wed, 30 Nov 2022 09:07:40 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74BA98BD1A for ; Wed, 30 Nov 2022 06:07:11 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id gu23so23382437ejb.10 for ; Wed, 30 Nov 2022 06:07:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=crtfe0BqYH7z6M5EdvzpYlnGHWPelxQYGarO1VmKQvw=; b=otqhoCh8Mfyz+qmipWbuwC3TgoKxWSKZ0iHSVOuvBsvwv7W4AUrr0dof5qilNIYMcy O5Db8C0CcRhQTQIYNzXaM2Vne0WAImxhNbYC6r/7Fx1/JRzV+QA2IV85FuFUefA1ZFI4 6Gk7jYT9ah0kMe5cV9LdmKNGaRlF113NP+fUuXmd8jkSnCRu0ejY9E44R3JXX7Ne+vuB 9vWqUc8KC+pFlSH1EtPDgCWNOHAMcZd3Q3x9E8so551HXFle6nHfS36G+RKgH9B90f81 5DP3NWvZMLcCnOi5syjz95eIXGgNcHi4PRIS7ceKYA4DIyHImvv2wcB6JQvVe5TeCc2A DhPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=crtfe0BqYH7z6M5EdvzpYlnGHWPelxQYGarO1VmKQvw=; b=4fQLqzSpesSUwqdwxyDuYdOeASasnM34xF4zHAc20sEkUAUqNw2TikOLaiImyZwmBq zNNt5847e253qlRkDXcMAaxg4QtJHfcXi8ZnCTJiuzJIwaOw7McLdVKs6QN9SRt8Z2eG LweMX7blAIPv12Ip6g/gvIQaAKinLwxUsuExMQ2JvdOG+aNs9WNSW2WCQyaaETyX8KS1 7q+3Bv6sdqXOYDAsCesRQhuRG3nIuFTaphGexn11AuISd7SX1Tl3IhRWYx9ylIcCk3fu 5hLjrxun7x3yGY1LLvyv25JRKxNjMgKVzh7+izqHHODgdyh+/NJhyNGnSJSwjm1ayxB1 6BeQ== X-Gm-Message-State: ANoB5pntrSqN9kw5+PZjr1wKUa4I3y9bPs2433VEsa+4lRpcW13uyWN1 AygSVntxzYzSf9aLP1dt9Koikg== X-Google-Smtp-Source: AA0mqf6iuqR5tkTBTX5XDYNTW/0KzzHvEQ3V6EgUmFA7Rz6lbNnAK+pA/9/lcq7SWOrS/f/bV6hEjg== X-Received: by 2002:a17:907:cb83:b0:7ad:f43a:cb0a with SMTP id un3-20020a170907cb8300b007adf43acb0amr37990314ejc.560.1669817229960; Wed, 30 Nov 2022 06:07:09 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:07:09 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 09/11] selftests: mptcp: listener test for userspace PM Date: Wed, 30 Nov 2022 15:06:31 +0100 Message-Id: <20221130140637.409926-10-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3985; i=matthieu.baerts@tessares.net; h=from:subject; bh=bIIKO9xkuUAb1XnV8gcwknYCwBdI9wFkRM47L72h+T8=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NpubqDWHxbifXmvSXmneZrESd5I3dNUavydpFi vSuR2UuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaQAKCRD2t4JPQmmgc9hgD/ 9gnV2rgJgPZ2ofqd1SbpeZkNWzNpgzoPb8ErESeVWdk71fcLXgZ+aPqRwHdmktIV/ae171hvvvq4Mw bWRxh6pFseApMksjLYPLIS89B0dzg8gCuPM+Mx0c66awI5L+2EpyC1Ni/Nc/zdNzsKPwjvohOzxfup LMPttz+5fKjDvLarL1Pr0sCxy6/jtXNPNixh0np4WrkyHq+NWscotw7hJdf1G3pAaslOIzqFB5VNBX L3vtsov4cVyuxOOahHUnJCjD9Xw6ax8FAadHBHbYCH3uthWIdCwzrn8lRk14he0lmpjKuZAY+FU6q7 So9yQOC5DBzt3X29uhxF8os/xfyN0oq8DF4bJhOu+EM5JrkhqjA7GdiSeimRoHDDxWrUlqFtyaRMgy KosuhwU7RVhaWcECOvNrfy6XR2WBGvGWFHR+wsasvd6tWsa8thGiTiCz/krJ77uuVT+n8uiQSKFKAY vhGbTajYFa65K2HG5esVQ19l7isnMsOE1U7rGDDrRawSZR1vz/R52yTecJGkL5B8PtgQjQ5zgQq32P e1ddchz3HLom4dDLmx0zs2lMvLHtuQYJU2Ds1pq83DdJMxHIGTp4Gv7QRDX6c5fZM8B6BCng66wX+P vtdq5ZMsSjv/y27Hd872amRcdE5WvdCbbKvxGivKs2mOQU+HO8r1i6uXx86A== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch adds test coverage for listening sockets created by userspace processes. It adds a new test named test_listener() and a new verifying helper verify_listener_events(). The new output looks like this: CREATE_SUBFLOW 10.0.2.2 (ns2) => 10.0.2.1 (ns1) [OK] DESTROY_SUBFLOW 10.0.2.2 (ns2) => 10.0.2.1 (ns1) [OK] MP_PRIO TX [OK] MP_PRIO RX [OK] CREATE_LISTENER 10.0.2.2:37106 [OK] CLOSE_LISTENER 10.0.2.2:37106 [OK] Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- .../selftests/net/mptcp/userspace_pm.sh | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 91d6f30e2fe4..a29deb9fa024 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -11,6 +11,8 @@ ANNOUNCED=6 # MPTCP_EVENT_ANNOUNCED REMOVED=7 # MPTCP_EVENT_REMOVED SUB_ESTABLISHED=10 # MPTCP_EVENT_SUB_ESTABLISHED SUB_CLOSED=11 # MPTCP_EVENT_SUB_CLOSED +LISTENER_CREATED=15 #MPTCP_EVENT_LISTENER_CREATED +LISTENER_CLOSED=16 #MPTCP_EVENT_LISTENER_CLOSED AF_INET=2 AF_INET6=10 @@ -781,11 +783,85 @@ test_prio() fi } +verify_listener_events() +{ + local evt=$1 + local e_type=$2 + local e_family=$3 + local e_saddr=$4 + local e_sport=$5 + local type + local family + local saddr + local sport + + if [ $e_type = $LISTENER_CREATED ]; then + stdbuf -o0 -e0 printf "CREATE_LISTENER %s:%s\t\t\t\t\t"\ + $e_saddr $e_sport + elif [ $e_type = $LISTENER_CLOSED ]; then + stdbuf -o0 -e0 printf "CLOSE_LISTENER %s:%s\t\t\t\t\t"\ + $e_saddr $e_sport + fi + + type=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q') + family=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q') + sport=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q') + if [ $family ] && [ $family = $AF_INET6 ]; then + saddr=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q') + else + saddr=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q') + fi + + if [ $type ] && [ $type = $e_type ] && + [ $family ] && [ $family = $e_family ] && + [ $saddr ] && [ $saddr = $e_saddr ] && + [ $sport ] && [ $sport = $e_sport ]; then + stdbuf -o0 -e0 printf "[OK]\n" + return 0 + fi + stdbuf -o0 -e0 printf "[FAIL]\n" + exit 1 +} + +test_listener() +{ + # Capture events on the network namespace running the client + :>$client_evts + + # Attempt to add a listener at 10.0.2.2: + ip netns exec $ns2 ./pm_nl_ctl listen 10.0.2.2\ + $client4_port > /dev/null 2>&1 & + local listener_pid=$! + + verify_listener_events $client_evts $LISTENER_CREATED $AF_INET 10.0.2.2 $client4_port + + # ADD_ADDR from client to server machine reusing the subflow port + ip netns exec $ns2 ./pm_nl_ctl ann 10.0.2.2 token $client4_token id\ + $client_addr_id > /dev/null 2>&1 + sleep 0.5 + + # CREATE_SUBFLOW from server to client machine + ip netns exec $ns1 ./pm_nl_ctl csf lip 10.0.2.1 lid 23 rip 10.0.2.2\ + rport $client4_port token $server4_token > /dev/null 2>&1 + sleep 0.5 + + # Delete the listener from the client ns, if one was created + kill_wait $listener_pid + + verify_listener_events $client_evts $LISTENER_CLOSED $AF_INET 10.0.2.2 $client4_port +} + make_connection make_connection "v6" test_announce test_remove test_subflows test_prio +test_listener exit 0 From patchwork Wed Nov 30 14:06:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059907 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A6E4C4332F for ; Wed, 30 Nov 2022 14:08:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbiK3OIx (ORCPT ); Wed, 30 Nov 2022 09:08:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbiK3OHk (ORCPT ); Wed, 30 Nov 2022 09:07:40 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F063E8BD1D for ; Wed, 30 Nov 2022 06:07:12 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id n21so41558703ejb.9 for ; Wed, 30 Nov 2022 06:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sr2PpWhxUJjRYOqYBbe/QkQ7A3T0Cv15MkXyo/pb3Ys=; b=te/8XCVvFXgYoOZPqtT6lepLDkAOy8Joc7cozwgOc9XRuZeM7N3ZCJIBspLoRYMQgB eb7WfhG65rUQU3tTORxGrb5Y38kFk4EsB5UmxHUGqZ6wi+0FM/4xMPQVwz2tWLmsb7/9 Rol/LXdBCSR1vBCQYFbJfa1mJ3qu2mkZ6v1JtfHT80tF47TC0/GmjFoJamIS1ZIb2TWz /qWJcSRLTEPZM/ClqTh41vPN/4oV+BVkDh77ifob5Wr1nON2aC1YPXBD8o7k2ClMfsO5 wWi3pjKHI1F9baAHUJB29n9UpTU5t4elkq05VUekZ0+mc1HYWJ20E6drQpLmyRuY65pW Guyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sr2PpWhxUJjRYOqYBbe/QkQ7A3T0Cv15MkXyo/pb3Ys=; b=gt4H1sQ18GkrmJPeCBc3p4zEL8ilV0wyj4oRk6roS3hI4qIMgR6GX7L1udUir0qG1q 87yphmLWlAlhOp3lAcHvS0nCtgEx6P1EkBGoU2Xmeq1gWn+xdhuZozGVER+W3RA1DKi7 RPQ1HrClKitSbxgGCe3aVu1/zwQlyeX1Np+geOSQr8vzPi4YU3Ce9Hf3WpUt0gQRZyzF OpejGsGpgZnBk6wri9lRXkS4sJnlAGC1JvmuGPocrxyZ0TY5H5Cp/GjevfiKSMKMq10h dVdm8PhMLwYGsQAaWdU4bbms4d1IrQpyriWriqCmRauYrjbchRJwo8wqrZ/r79a4hVUN tmZA== X-Gm-Message-State: ANoB5pnJZRoZ+dzgh3sRPKPWT+ff+cGKMXj5HRbhIjd6qXO/0jR2r1VG aVNGyyks8lSVs4HXlvuVVUHBPA== X-Google-Smtp-Source: AA0mqf6lsYvNUFGiWOpZkQZQ1fFVQBGXBtNOItwT+lHprMVk1JdOHjeYTj0M4cZ++LdcKimhYkWN9Q== X-Received: by 2002:a17:906:8d86:b0:78d:4742:bb62 with SMTP id ry6-20020a1709068d8600b0078d4742bb62mr40839749ejc.43.1669817231344; Wed, 30 Nov 2022 06:07:11 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:07:11 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 10/11] selftests: mptcp: make evts global in mptcp_join Date: Wed, 30 Nov 2022 15:06:32 +0100 Message-Id: <20221130140637.409926-11-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3931; i=matthieu.baerts@tessares.net; h=from:subject; bh=jy0B03U7SrhLzNlNUKrDAPk8Nk4bPwGVN5x25PhFK6c=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NpnOwKZdKU09wPqiAzSf1DGh69laqfo7KTdlqS 1JBirrqJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaQAKCRD2t4JPQmmgcwRbEA C5T21uKknBYwWFEyvIRWOP3qoh4GQvKVV2C2moqK67KLl4CW36OmjAGDfAm3tgAq6x6sxPlfaHhN1o Jod7ick/pd/wqfXqocyrPx/Yorf0TbjrpySKuwqMh5NmcHMVxgenYtS18TzG3AvgcMwYcx/Ijo7yGn QajMkTgEUQA0rEql5my1622INoY52AB6wLGw/Rwp0WdjyAWFAUl1sshcDBW6UGAkRX9jhJWEErB7ow zD4J/wxjADbYKMc5X78wvmUZumsLyDw8ieUYSLPuXyfeTVzWXIfd36viX3MJjboKsnOvpf6Mqy6pfb E7jHpOedyZ943qfZ8d5ZTdA3fFMJAdhsWyoPTvaLeKm6czjzcXaOqcaXEiIDEwFmwqTVCRfhBMAbPc e4VMvWedTkkF6/7j+GsFZ8AGXdcsw55NhY7paYdC9JCxg7UNhO1ftWzZIERMVzcF3oznpCsQZz1tZj pyBHEc85D0tukQoSFOGpNsxu4jEwgkJoVB5L51zkMy1iI399OPRWj5zZgWwmCmJeQwbixclLsvSKjo nHQ5HS8kgKFjECtXX4KzixYb6P7G+cjX4SZ+ne7UuUQciOo3/+JhcTgQI16CX4O//G7eFNwIWuUSra Caf9qXPQ1rE3N3nN7y2BVKk5bWVDBhNO7Mi7IAhe4HvJ9WOKbY5VXDsGTEmg== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch moves evts_ns1 and evts_ns2 out of do_transfer() as two global variables in mptcp_join.sh. Init them in init() and remove them in cleanup(). Add a new helper reset_with_events() to save the outputs of 'pm_nl_ctl events' command in them. And a new helper kill_events_pids() to kill pids of 'pm_nl_ctl events' command. Use these helpers in userspace pm tests. Suggested-by: Paolo Abeni Signed-off-by: Geliang Tang Acked-by: Paolo Abeni Signed-off-by: Matthieu Baerts --- .../testing/selftests/net/mptcp/mptcp_join.sh | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index f10ef65a7009..32a3694c57fb 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -26,6 +26,10 @@ ip_mptcp=0 check_invert=0 validate_checksum=0 init=0 +evts_ns1="" +evts_ns2="" +evts_ns1_pid=0 +evts_ns2_pid=0 declare -A all_tests declare -a only_tests_ids @@ -154,6 +158,8 @@ init() { cin=$(mktemp) cinsent=$(mktemp) cout=$(mktemp) + evts_ns1=$(mktemp) + evts_ns2=$(mktemp) trap cleanup EXIT @@ -165,6 +171,7 @@ cleanup() { rm -f "$cin" "$cout" "$sinfail" rm -f "$sin" "$sout" "$cinsent" "$cinfail" + rm -rf $evts_ns1 $evts_ns2 cleanup_partial } @@ -320,6 +327,18 @@ reset_with_fail() index 100 || exit 1 } +reset_with_events() +{ + reset "${1}" || return 1 + + :> "$evts_ns1" + :> "$evts_ns2" + ip netns exec $ns1 ./pm_nl_ctl events >> "$evts_ns1" 2>&1 & + evts_ns1_pid=$! + ip netns exec $ns2 ./pm_nl_ctl events >> "$evts_ns2" 2>&1 & + evts_ns2_pid=$! +} + fail_test() { ret=1 @@ -473,6 +492,12 @@ kill_wait() wait $1 2>/dev/null } +kill_events_pids() +{ + kill_wait $evts_ns1_pid + kill_wait $evts_ns2_pid +} + pm_nl_set_limits() { local ns=$1 @@ -673,10 +698,6 @@ do_transfer() local port=$((10000 + TEST_COUNT - 1)) local cappid local userspace_pm=0 - local evts_ns1 - local evts_ns1_pid - local evts_ns2 - local evts_ns2_pid :> "$cout" :> "$sout" @@ -753,17 +774,6 @@ do_transfer() addr_nr_ns2=${addr_nr_ns2:9} fi - if [ $userspace_pm -eq 1 ]; then - evts_ns1=$(mktemp) - evts_ns2=$(mktemp) - :> "$evts_ns1" - :> "$evts_ns2" - ip netns exec ${listener_ns} ./pm_nl_ctl events >> "$evts_ns1" 2>&1 & - evts_ns1_pid=$! - ip netns exec ${connector_ns} ./pm_nl_ctl events >> "$evts_ns2" 2>&1 & - evts_ns2_pid=$! - fi - local local_addr if is_v6 "${connect_addr}"; then local_addr="::" @@ -982,12 +992,6 @@ do_transfer() kill $cappid fi - if [ $userspace_pm -eq 1 ]; then - kill_wait $evts_ns1_pid - kill_wait $evts_ns2_pid - rm -rf $evts_ns1 $evts_ns2 - fi - NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ nstat | grep Tcp > /tmp/${listener_ns}.out NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ @@ -2961,22 +2965,24 @@ userspace_tests() fi # userspace pm add & remove address - if reset "userspace pm add & remove address"; then + if reset_with_events "userspace pm add & remove address"; then set_userspace_pm $ns1 pm_nl_set_limits $ns2 1 1 run_tests $ns1 $ns2 10.0.1.1 0 userspace_1 0 slow chk_join_nr 1 1 1 chk_add_nr 1 1 chk_rm_nr 1 1 invert + kill_events_pids fi # userspace pm create destroy subflow - if reset "userspace pm create destroy subflow"; then + if reset_with_events "userspace pm create destroy subflow"; then set_userspace_pm $ns2 pm_nl_set_limits $ns1 0 1 run_tests $ns1 $ns2 10.0.1.1 0 0 userspace_1 slow chk_join_nr 1 1 1 chk_rm_nr 0 1 + kill_events_pids fi } From patchwork Wed Nov 30 14:06:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13059908 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5E9DC4332F for ; Wed, 30 Nov 2022 14:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229919AbiK3OJV (ORCPT ); Wed, 30 Nov 2022 09:09:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229938AbiK3OHo (ORCPT ); Wed, 30 Nov 2022 09:07:44 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C9498BD22 for ; Wed, 30 Nov 2022 06:07:14 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id z20so24175166edc.13 for ; Wed, 30 Nov 2022 06:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xHXcuy6oLE+Bgau9uGaJ5XFA1fmV6aif/DsLUjpATIk=; b=6pAl5L0VLYVXTiFnKW5E0skgWr5aO+z+xDFrjrFCoygUB9HiXC6ugck9ATxUopyWti H8wqG8ibFuGqDbf4IxVAeG+MNjsB02sYm/XJbeaxKF+IZSNU1+5NIlmQlMshCEMMrDx3 LEJ9Fb9y+F9bLOtrqPFQ07p4zXiLA1tFbD4mnU+5cHobdfroCt9rehpFbgt1DeVNtU+G cyXZM79AcPgsgUPEed9ODLeH0n14OrTVbrJUzxNPSz+thEi1umaCxayYXmLyegjTfds7 w1k4hD/aBdMHN4e4zelHwEEEqCnfdJnHIoAdgIlbQsP0O5tJ9n5Qjt/ssncXzjqO26aU p+VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xHXcuy6oLE+Bgau9uGaJ5XFA1fmV6aif/DsLUjpATIk=; b=4ljbSPc/CDuQgXhR0s8oUE4XI802Nx35az07TyqiLcqC6ZQxPyGuiq/SSnGJimWuS7 u5B9azw3H36s3If//ed0PTsj9YNNo+Zjix9kylpqIXEaKO64XrZo8GuERA7m49OUvIre PX8Sm/jkopU245v69qZuzxJHvAIMyBz5OhNgfT+XK8GFbNN29J4MccAEF8StjqbuZbzr /W9pn9CpkrDnQQc5m/DyP1xibJCFZ4bFrVvD0q0yW05BNsv9w6tp1qOP4NC2ZGknUCgh EbCAiV8DuxlfwDi0EXQuTB8E5p53dzWxYI/wYpwDFsk9z8Vp71E3m2S3w2NBZkjaOajM aNcg== X-Gm-Message-State: ANoB5pnh3QSOhAdleT+Q5zpmyBoA/VjnI0caGQs5bVUc6WZcZWYGbnLB wg7zrsdWaMKjGMfbpK6pySisjQ== X-Google-Smtp-Source: AA0mqf6ewQ3Wcmzfrxx1kg91XYTrJwaHBigrcJyyV4Am60DQzR9SUx1Bh1B7j8tYPPI+bjGnpvw8TA== X-Received: by 2002:a05:6402:2074:b0:46a:bb9e:40d1 with SMTP id bd20-20020a056402207400b0046abb9e40d1mr23210839edb.242.1669817232990; Wed, 30 Nov 2022 06:07:12 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id mh1-20020a170906eb8100b0073d83f80b05sm692454ejb.94.2022.11.30.06.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:07:12 -0800 (PST) From: Matthieu Baerts To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 11/11] selftests: mptcp: listener test for in-kernel PM Date: Wed, 30 Nov 2022 15:06:33 +0100 Message-Id: <20221130140637.409926-12-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221130140637.409926-1-matthieu.baerts@tessares.net> References: <20221130140637.409926-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3645; i=matthieu.baerts@tessares.net; h=from:subject; bh=GYVgZ0ERRFhrNn6nnoF5lHfo9sSALlgzV4tXPFj4Gfk=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBjh2NpDQZZlZIAutRRRraikXlvQ/bHo9/MRdBkQPGS nPdMgDOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY4djaQAKCRD2t4JPQmmgcyohD/ 91r32UYsZ+REfGf2SMW49ZwRShsLHwi5nPmiCAvVMANuAb2Y3i5PhjtnNnJCQLYLvgWRTQsH4YTNUg GQFlLgIUEygrccr5MOayeQePm0fDejaZHUjk5CW39jGzXwvgOqRvS712fn6ozELABLwvGHbSJRJV5y 9D9u0mscDRn8umN+CLnKKDdAtgrOXXLUwqYlZ73AqhRy+TVWvzc0fNyXNpfhoHxyzFgM504MzfJlUH yS/qOmPKSFW7q20nRSRvkM4h1Uy/7McV7bSLsBXa4zMOruaYE0nYHOiFkOx3Bxk/3ZFvBe1DQlit6g MR8ml8BpXoh0BYUKpP0NWZrD4bahTKRaxMjQRl3ozG4brL1ox1RP0Bt69iT56TGf7kV2sNMB3mMr19 q8UrJTPtBd4B7m1GeDmrGOUtaqjxyjRJXVSQvObhNfIO/V2RV1i9eIbziAgXUvQKslgRdFQz7F5qCB 8hVWKG+47EqvJ/FSMdgNjCy9nM1+x3CJXO25g/G6VL3qub3xE1ztOATl1vYR09TpSq1907TsZX5Fp8 J98/rJGjupG6Q5k1qrnCVYSzZsD4ARUpH9Rm3kigqIyf9vGVnUwC6dVWMQde0yTYmnLNbCxZLHn1uU kUCTllIMXHZv7MTbvuurpLPDWpao7kRurC+kTPJg2jRU6+/mXJrna2SOKsrQ== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Geliang Tang This patch adds test coverage for listening sockets created by the in-kernel path manager in mptcp_join.sh. It adds the listener event checking in the existing "remove single address with port" test. The output looks like this: 003 remove single address with port syn[ ok ] - synack[ ok ] - ack[ ok ] add[ ok ] - echo [ ok ] - pt [ ok ] syn[ ok ] - synack[ ok ] - ack[ ok ] syn[ ok ] - ack [ ok ] rm [ ok ] - rmsf [ ok ] invert CREATE_LISTENER 10.0.2.1:10100[ ok ] CLOSE_LISTENER 10.0.2.1:10100 [ ok ] Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- .../testing/selftests/net/mptcp/mptcp_join.sh | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 32a3694c57fb..d11d3d566608 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -2513,6 +2513,57 @@ backup_tests() fi } +LISTENER_CREATED=15 #MPTCP_EVENT_LISTENER_CREATED +LISTENER_CLOSED=16 #MPTCP_EVENT_LISTENER_CLOSED + +AF_INET=2 +AF_INET6=10 + +verify_listener_events() +{ + local evt=$1 + local e_type=$2 + local e_family=$3 + local e_saddr=$4 + local e_sport=$5 + local type + local family + local saddr + local sport + + if [ $e_type = $LISTENER_CREATED ]; then + stdbuf -o0 -e0 printf "\t\t\t\t\t CREATE_LISTENER %s:%s"\ + $e_saddr $e_sport + elif [ $e_type = $LISTENER_CLOSED ]; then + stdbuf -o0 -e0 printf "\t\t\t\t\t CLOSE_LISTENER %s:%s "\ + $e_saddr $e_sport + fi + + type=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q') + family=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q') + sport=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q') + if [ $family ] && [ $family = $AF_INET6 ]; then + saddr=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q') + else + saddr=$(grep "type:$e_type," $evt | + sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q') + fi + + if [ $type ] && [ $type = $e_type ] && + [ $family ] && [ $family = $e_family ] && + [ $saddr ] && [ $saddr = $e_saddr ] && + [ $sport ] && [ $sport = $e_sport ]; then + stdbuf -o0 -e0 printf "[ ok ]\n" + return 0 + fi + fail_test + stdbuf -o0 -e0 printf "[fail]\n" +} + add_addr_ports_tests() { # signal address with port @@ -2537,7 +2588,8 @@ add_addr_ports_tests() fi # single address with port, remove - if reset "remove single address with port"; then + # pm listener events + if reset_with_events "remove single address with port"; then pm_nl_set_limits $ns1 0 1 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal port 10100 pm_nl_set_limits $ns2 1 1 @@ -2545,6 +2597,10 @@ add_addr_ports_tests() chk_join_nr 1 1 1 chk_add_nr 1 1 1 chk_rm_nr 1 1 invert + + verify_listener_events $evts_ns1 $LISTENER_CREATED $AF_INET 10.0.2.1 10100 + verify_listener_events $evts_ns1 $LISTENER_CLOSED $AF_INET 10.0.2.1 10100 + kill_events_pids fi # subflow and signal with port, remove