* [PATCH net-next,v2] selftests: bonding: create directly devices in the target namespaces
@ 2023-08-24 13:57 Zhengchao Shao
2023-08-25 2:36 ` Hangbin Liu
0 siblings, 1 reply; 3+ messages in thread
From: Zhengchao Shao @ 2023-08-24 13:57 UTC (permalink / raw)
To: netdev, linux-kselftest, shuah
Cc: j.vosburgh, andy, weiyongjun1, yuehaibing, shaozhengchao
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>
---
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..fe7c34f89fc7 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 link add dev eth0 netns client 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next,v2] selftests: bonding: create directly devices in the target namespaces
2023-08-24 13:57 [PATCH net-next,v2] selftests: bonding: create directly devices in the target namespaces Zhengchao Shao
@ 2023-08-25 2:36 ` Hangbin Liu
2023-08-25 9:57 ` shaozhengchao
0 siblings, 1 reply; 3+ messages in thread
From: Hangbin Liu @ 2023-08-25 2:36 UTC (permalink / raw)
To: Zhengchao Shao
Cc: netdev, linux-kselftest, shuah, j.vosburgh, andy, weiyongjun1,
yuehaibing
On Thu, Aug 24, 2023 at 09:57:15PM +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>
> ---
> 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..fe7c34f89fc7 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 link add dev eth0 netns client type veth peer name eth0 netns server
When we already have an eth0 interface on init net, this cmd will failed
# ip link add dev eth0 netns client type veth peer name eth0 netns server
RTNETLINK answers: File exists
You should create the eth0 in the namespace, e.g.
# ip -n client link add eth0 type veth peer name eth0 netns server
Thanks
Hangbin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next,v2] selftests: bonding: create directly devices in the target namespaces
2023-08-25 2:36 ` Hangbin Liu
@ 2023-08-25 9:57 ` shaozhengchao
0 siblings, 0 replies; 3+ messages in thread
From: shaozhengchao @ 2023-08-25 9:57 UTC (permalink / raw)
To: Hangbin Liu
Cc: netdev, linux-kselftest, shuah, j.vosburgh, andy, weiyongjun1,
yuehaibing
On 2023/8/25 10:36, Hangbin Liu wrote:
> On Thu, Aug 24, 2023 at 09:57:15PM +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>
>> ---
>> 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..fe7c34f89fc7 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 link add dev eth0 netns client type veth peer name eth0 netns server
>
> When we already have an eth0 interface on init net, this cmd will failed
>
> # ip link add dev eth0 netns client type veth peer name eth0 netns server
> RTNETLINK answers: File exists
>
> You should create the eth0 in the namespace, e.g.
>
> # ip -n client link add eth0 type veth peer name eth0 netns server
>
> Thanks
> Hangbin
Hi Hangbin:
Thank you for your testing. I will modify in v3
Zhengchao Shao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-25 9:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 13:57 [PATCH net-next,v2] selftests: bonding: create directly devices in the target namespaces Zhengchao Shao
2023-08-25 2:36 ` Hangbin Liu
2023-08-25 9:57 ` shaozhengchao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).