diff mbox series

[net-next,v3] selftests: bonding: create directly devices in the target namespaces

Message ID 20230826022330.3474899-1-shaozhengchao@huawei.com (mailing list archive)
State Accepted
Commit bf68583624c56bab26b4394fb4721461ded62f94
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v3] selftests: bonding: create directly devices in the target namespaces | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

shaozhengchao Aug. 26, 2023, 2:23 a.m. UTC
If failed to set link1_1 to netns client, we should delete link1_1 in the
cleanup path. But if set link1_1 to netns client successfully, delete
link1_1 will report warning. So it will be safer creating directly the
devices in the target namespaces.

Reported-by: Hangbin Liu <liuhangbin@gmail.com>
Closes: https://lore.kernel.org/all/ZNyJx1HtXaUzOkNA@Laptop-X1/
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
v3: create the eth0 in the namespace
v2: create directly devices in the target namespaces
---
 .../drivers/net/bonding/bond-arp-interval-causes-panic.sh | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Hangbin Liu Aug. 28, 2023, 6:04 a.m. UTC | #1
On Sat, Aug 26, 2023 at 10:23:30AM +0800, Zhengchao Shao wrote:
> If failed to set link1_1 to netns client, we should delete link1_1 in the
> cleanup path. But if set link1_1 to netns client successfully, delete
> link1_1 will report warning. So it will be safer creating directly the
> devices in the target namespaces.
> 
> Reported-by: Hangbin Liu <liuhangbin@gmail.com>
> Closes: https://lore.kernel.org/all/ZNyJx1HtXaUzOkNA@Laptop-X1/
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
> v3: create the eth0 in the namespace
> v2: create directly devices in the target namespaces
> ---
>  .../drivers/net/bonding/bond-arp-interval-causes-panic.sh | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh b/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
> index 7b2d421f09cf..4917dbb35a44 100755
> --- a/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
> +++ b/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
> @@ -22,14 +22,12 @@ server_ip4=192.168.1.254
>  echo 180 >/proc/sys/kernel/panic
>  
>  # build namespaces
> -ip link add dev link1_1 type veth peer name link1_2
> -
>  ip netns add "server"
> -ip link set dev link1_2 netns server up name eth0
> +ip netns add "client"
> +ip -n client link add eth0 type veth peer name eth0 netns server
> +ip netns exec server ip link set dev eth0 up
>  ip netns exec server ip addr add ${server_ip4}/24 dev eth0
>  
> -ip netns add "client"
> -ip link set dev link1_1 netns client down name eth0
>  ip netns exec client ip link add dev bond0 down type bond mode 1 \
>  	miimon 100 all_slaves_active 1
>  ip netns exec client ip link set dev eth0 down master bond0
> -- 
> 2.34.1
> 

Acked-by: Hangbin Liu <liuhangbin@gmail.com>
patchwork-bot+netdevbpf@kernel.org Aug. 28, 2023, 9:30 a.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Sat, 26 Aug 2023 10:23:30 +0800 you wrote:
> If failed to set link1_1 to netns client, we should delete link1_1 in the
> cleanup path. But if set link1_1 to netns client successfully, delete
> link1_1 will report warning. So it will be safer creating directly the
> devices in the target namespaces.
> 
> Reported-by: Hangbin Liu <liuhangbin@gmail.com>
> Closes: https://lore.kernel.org/all/ZNyJx1HtXaUzOkNA@Laptop-X1/
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> 
> [...]

Here is the summary with links:
  - [net-next,v3] selftests: bonding: create directly devices in the target namespaces
    https://git.kernel.org/bpf/bpf-next/c/bf68583624c5

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh b/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
index 7b2d421f09cf..4917dbb35a44 100755
--- a/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
+++ b/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
@@ -22,14 +22,12 @@  server_ip4=192.168.1.254
 echo 180 >/proc/sys/kernel/panic
 
 # build namespaces
-ip link add dev link1_1 type veth peer name link1_2
-
 ip netns add "server"
-ip link set dev link1_2 netns server up name eth0
+ip netns add "client"
+ip -n client link add eth0 type veth peer name eth0 netns server
+ip netns exec server ip link set dev eth0 up
 ip netns exec server ip addr add ${server_ip4}/24 dev eth0
 
-ip netns add "client"
-ip link set dev link1_1 netns client down name eth0
 ip netns exec client ip link add dev bond0 down type bond mode 1 \
 	miimon 100 all_slaves_active 1
 ip netns exec client ip link set dev eth0 down master bond0