Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp611393lqp; Fri, 5 Apr 2024 03:54:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUO+boXCxmO3FueITCK7ii82lInaXFmEJzsicXVJi4ckdkCmuge3tTWbjqWLf4cgtY03ukxqXqA6P/8V9KuGdyQI5KdzgzdJIzHMPtn7g== X-Google-Smtp-Source: AGHT+IH2Uiq/OtlG66KjoFcXCuCaPEoWoPGUi7+PyQnKspRyofN6xGZl2IMfCAIiOh8IiIwq72o9 X-Received: by 2002:a17:906:c104:b0:a51:90af:27ca with SMTP id do4-20020a170906c10400b00a5190af27camr974965ejc.55.1712314460135; Fri, 05 Apr 2024 03:54:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712314460; cv=pass; d=google.com; s=arc-20160816; b=hGcRr74iUuP9vKxmBdH2aSH5MP7gcjAwLzsGww8FbddPayX3OJgj7d22oGtuq2K6+E oAZm+4/859c0QArS8nBQLBMuQVOQCC7FCPTvk+eSMbTixZdsVUgNCLYs4rLHWX4p7YVk 8QW+0MtjMLEfyDb2Qync3Mo5fMrUR7spcPFMbG5X/OJTWBuzVQ1v+jKx2UenooZqnzt1 ZKtCwiYOHvlvm9+rLaKYcsMRR6YtF+twoz65dL7+lA1hVXxevwpbxppSdZ4IVwU9K6Cr uGK/qzoNahFnOBNI9H7XWxOGmNBc5CXpgcRdR9mY/QTWI0zNDV5BOsexdvJVITbuVu0t w1zw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=gU2QnmPKL63ZkPxzFUACnj84roRad3X6VRtbzk/hL/Q=; fh=gM1fTaWoK9TL7webZ8yB3tcO8X47vwS7DNlJ3C0B/Lk=; b=ppcej3mdAoAisQCbLyLCbOsKvgv7XiIRVtejuoS/h99EKK/NRBJ1ODqLMZXxXfmBql iF9kQ6Wgv1ZOaz+eWpNV1AySaJM8BRrZQ+FgPiHGXgPCoys2uEbXvmqm9rbuZDnI1qJ/ 4YI9h23qNzAtyzgmLRtnwoKa2lUEg85ZsQVyYi7vA1DyieribPnlsE39dZJ4yr1Ojs1m Ev1w+GMirQXVytNa0btiy6tniSWVK+XvRCuFP7rpscR/y/HCYaP9kfFdfHtT0++fm5yi wrI+tEVH3i/YNKYN+Gl+c2+t4HPdAN7YjVTk2sAThf/8s7IkyWr3FF+Ahfr5BXp6gRf8 aKvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ttm1skQA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132860-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x16-20020a170906299000b00a466884137bsi609872eje.15.2024.04.05.03.54.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:54:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ttm1skQA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132860-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D482D1F22757 for ; Fri, 5 Apr 2024 10:54:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03D2716C87B; Fri, 5 Apr 2024 10:52:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ttm1skQA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 201B416C865; Fri, 5 Apr 2024 10:52:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314364; cv=none; b=Ki2NUq/zpvOLYuxGaFTQknYRNKIvuiFppCBTIcMNLOOGmh80BRI5pOPwfsPBUwf/G/dRadJL1wK/Z9gHcafW82eNJgJ1ViNrmDdqNgsRl0of36qKCuBr11yE8S/YErTcFxOJ3M9q/Us6s5fbSnT3pkvSo9iYNB6GoPR++kuRl0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314364; c=relaxed/simple; bh=WdRiy6HK/oka5IiC6YkmLJw1/RyysTXM95OHJrdHMHw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Pr6oTlCHsRGS7mwkUsPlv/52oRHtApcqIdyeqVBddchuH9HK6A6tZCeyezRWmowPJjSfXVcPYGPJtwF5JS84jKYNdJT7Cjq4Bnt9exa//bdFUOTWdvVjMo+lxL18pp9TAjXbxu81QNLJx3DfEuIsaYPViXHJtKbPKMFvsffy7tQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ttm1skQA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03ABBC43390; Fri, 5 Apr 2024 10:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712314363; bh=WdRiy6HK/oka5IiC6YkmLJw1/RyysTXM95OHJrdHMHw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ttm1skQAhOeN/jOxF3z13kalmZf65wwd8fD23T0kY/2hGIDZdn9RWbW+mlDl8BVB2 RDh+16IM5qMRaOqo4kGDvT6fOq55g9Rd+FYOHaYL0yTysoHLytOzzRELcsK/sUkmEN s0suzYg5xru+DAK5W7BUamqBOBdIGO0D11Y8/YqYsdRerBaf//WKUmXjmZkfGeRoVl W/2McxGcJmIDsG2/8uFWPHaWxdwGomNyouwqa+gFVyjUOqdL684h2lRN5OcKY7ZxG8 7pwe5LGN/ftOzaJdXkiHO0KZwealT8vO3f3q8WQ7n3FkN2acXY0UUWfudqri9g5Vc/ 6zb3EaaQ+aIUA== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Apr 2024 12:52:10 +0200 Subject: [PATCH net-next 06/11] selftests: mptcp: netlink: add change_address helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-6-eabc9b960966@kernel.org> References: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-0-eabc9b960966@kernel.org> In-Reply-To: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-0-eabc9b960966@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1997; i=matttbe@kernel.org; h=from:subject:message-id; bh=1mO+KsbMEu53NeIIzW9cMyK5QgtJ/nYDKgdCteaDqIc=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmD9flBcijNdTb8U2ePotkbk8EWMG/mdX2wLjCN E3MPfzHMp2JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZg/X5QAKCRD2t4JPQmmg c+6QEACHNR6j8Bnqk6AT+Ua14XQ3QHNh+nxNgBPwib5ZUcNUL5e/XPvl2hu7Yl+d9Uh3OlgNpag /y9haF+/CG+cna/LD/qYIDlW9kA29VfURIg+2AT2czHx8H8vY/vrNS1qD9KczSN7/hwmZTqZCPI Be+5rPFtGl82uiPBTmKN5akOZRTrCIr8sES2Hy6ptcX0Z5PwLIEpYSaDf1Zakgf/O5Bxi5rDPAP LH/J9jxO2KN4/TJAfmSPdHsJYofK1jfBSinb/FngvF5spnNbE5b4XEeCMEeVnRyGCppzBaCChCo IpQ5dax6rtMuu/n9Z5aty8LOy1qtc0BZbbl+G8gxaUcwyNBoJnnMTM0zFFsc66WL/t7HUc8U31P i2WvkkslSqZQfGOcbZvSkGgqoRhy0R3ahdAVFq/tqwIWFTT0fMisJb+XJzbUrf/ArCICg8qY9ih A1yb9SFQ6asldYX/w5WICPEG5SRpG82OATkzsOqUFiD5esd0280p0cB4FWDXUIi7Vrs4XQdzzb8 JYxVhy1RvIkxxRl4/SxQG1YdzWyXptjgMqQG7q8vAW8YsdGUGZDbwy26KNdlw1WkZiLPi2An0cE E1kHGWQAu6rFbrF31xwQwiL2lm3g5MWUpAufUT3wQlYjfyKd7BxF7xlzTLeNFUs4B7Y5AgFloKv ONxtboAKXPsXe+g== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang The output formats of 'ip mptcp' commands are much different from that of 'pm_nl_ctl' commands. A new 'change_address' helper is added here, to change the flag of an address. This is a bit similar to mptcp_join.sh's pm_nl_change_endpoint(). Usage: Address ID - pm_nl_change_endpoint $ns id $id $flags IP address - change_address $ns $addr $flags Use this new helper in pm_netlink.sh to replace all 'pm_nl_ctl set' commands. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index 234b88eba0cb..e27a731bd765 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -75,6 +75,17 @@ get_endpoint() { mptcp_lib_pm_nl_get_endpoint "${ns1}" "${@}" } +change_address() { + local addr=${1} + local flags=${2} + + if mptcp_lib_is_ip_mptcp; then + ip -n "${ns1}" mptcp endpoint change "${addr}" "${flags}" + else + ip netns exec "${ns1}" ./pm_nl_ctl set "${addr}" flags "${flags}" + fi +} + check() { local cmd="$1" @@ -197,10 +208,10 @@ check "ip netns exec $ns1 ./pm_nl_ctl dump" \ ip netns exec $ns1 ./pm_nl_ctl flush ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 flags subflow -ip netns exec $ns1 ./pm_nl_ctl set 10.0.1.1 flags backup +change_address 10.0.1.1 backup check "ip netns exec $ns1 ./pm_nl_ctl dump" "$(format_endpoints "1,10.0.1.1,subflow backup")" \ "set flags (backup)" -ip netns exec $ns1 ./pm_nl_ctl set 10.0.1.1 flags nobackup +change_address 10.0.1.1 nobackup check "ip netns exec $ns1 ./pm_nl_ctl dump" "$(format_endpoints "1,10.0.1.1,subflow")" \ " (nobackup)" -- 2.43.0