diff options
author | Geliang Tang <tanggeliang@kylinos.cn> | 2024-04-05 12:52:10 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-04-08 11:53:21 +0100 |
commit | b79e51c9994970699a0f488a7c121699d4595581 (patch) | |
tree | 3ed0222122f78b95a5c84935cf8c5fd1364bb425 /tools | |
parent | 0d16ed0c2e743a721e372c64be73b828a0cf7cb9 (diff) | |
download | linux-stable-b79e51c9994970699a0f488a7c121699d4595581.tar.gz linux-stable-b79e51c9994970699a0f488a7c121699d4595581.tar.bz2 linux-stable-b79e51c9994970699a0f488a7c121699d4595581.zip |
selftests: mptcp: netlink: add change_address helper
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 <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/selftests/net/mptcp/pm_netlink.sh | 15 |
1 files 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)" |