netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] selftests: avoid using ifconfig
@ 2025-07-30 11:53 Eric Dumazet
  2025-07-30 12:56 ` Hangbin Liu
  2025-08-02  0:14 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2025-07-30 11:53 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, eric.dumazet, Eric Dumazet, Dong Chenchen

ifconfig is deprecated and not always present, use ip command instead.

Fixes: e0f3b3e5c77a ("selftests: Add test cases for vlan_filter modification during runtime")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Dong Chenchen <dongchenchen2@huawei.com>
---
 tools/testing/selftests/net/vlan_hw_filter.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/net/vlan_hw_filter.sh b/tools/testing/selftests/net/vlan_hw_filter.sh
index 0fb56baf28e4a477ea68af1d8461f0ee82ca528d..e195d5cab6f75aa069b3952e850e73272b774a28 100755
--- a/tools/testing/selftests/net/vlan_hw_filter.sh
+++ b/tools/testing/selftests/net/vlan_hw_filter.sh
@@ -55,10 +55,10 @@ test_vlan0_del_crash_01() {
 	ip netns exec ${NETNS} ip link add bond0 type bond mode 0
 	ip netns exec ${NETNS} ip link add link bond0 name vlan0 type vlan id 0 protocol 802.1q
 	ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
-	ip netns exec ${NETNS} ifconfig bond0 up
+	ip netns exec ${NETNS} ip link set dev bond0 up
 	ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter on
-	ip netns exec ${NETNS} ifconfig bond0 down
-	ip netns exec ${NETNS} ifconfig bond0 up
+	ip netns exec ${NETNS} ip link set dev bond0 down
+	ip netns exec ${NETNS} ip link set dev bond0 up
 	ip netns exec ${NETNS} ip link del vlan0 || fail "Please check vlan HW filter function"
 	cleanup
 }
@@ -68,11 +68,11 @@ test_vlan0_del_crash_02() {
 	setup
 	ip netns exec ${NETNS} ip link add bond0 type bond mode 0
 	ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
-	ip netns exec ${NETNS} ifconfig bond0 up
+	ip netns exec ${NETNS} ip link set dev bond0 up
 	ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter on
 	ip netns exec ${NETNS} ip link add link bond0 name vlan0 type vlan id 0 protocol 802.1q
-	ip netns exec ${NETNS} ifconfig bond0 down
-	ip netns exec ${NETNS} ifconfig bond0 up
+	ip netns exec ${NETNS} ip link set dev bond0 down
+	ip netns exec ${NETNS} ip link set dev bond0 up
 	ip netns exec ${NETNS} ip link del vlan0 || fail "Please check vlan HW filter function"
 	cleanup
 }
@@ -84,9 +84,9 @@ test_vlan0_del_crash_03() {
 	ip netns exec ${NETNS} ip link add bond0 type bond mode 0
 	ip netns exec ${NETNS} ip link add link bond0 name vlan0 type vlan id 0 protocol 802.1q
 	ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
-	ip netns exec ${NETNS} ifconfig bond0 up
+	ip netns exec ${NETNS} ip link set dev bond0 up
 	ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter on
-	ip netns exec ${NETNS} ifconfig bond0 down
+	ip netns exec ${NETNS} ip link set dev bond0 down
 	ip netns exec ${NETNS} ip link del vlan0 || fail "Please check vlan HW filter function"
 	cleanup
 }
-- 
2.50.1.552.g942d659e1b-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] selftests: avoid using ifconfig
  2025-07-30 11:53 [PATCH net] selftests: avoid using ifconfig Eric Dumazet
@ 2025-07-30 12:56 ` Hangbin Liu
  2025-07-30 14:51   ` Stephen Hemminger
  2025-08-02  0:14 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2025-07-30 12:56 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	netdev, eric.dumazet, Dong Chenchen

On Wed, Jul 30, 2025 at 11:53:13AM +0000, Eric Dumazet wrote:
> ifconfig is deprecated and not always present, use ip command instead.
> 
> Fixes: e0f3b3e5c77a ("selftests: Add test cases for vlan_filter modification during runtime")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Dong Chenchen <dongchenchen2@huawei.com>

Not sure if there is a way to replace the ifconfig in rtnetlink.sh.

Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] selftests: avoid using ifconfig
  2025-07-30 12:56 ` Hangbin Liu
@ 2025-07-30 14:51   ` Stephen Hemminger
  2025-07-31  1:16     ` Hangbin Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2025-07-30 14:51 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev, eric.dumazet, Dong Chenchen

On Wed, 30 Jul 2025 12:56:19 +0000
Hangbin Liu <liuhangbin@gmail.com> wrote:

> On Wed, Jul 30, 2025 at 11:53:13AM +0000, Eric Dumazet wrote:
> > ifconfig is deprecated and not always present, use ip command instead.
> > 
> > Fixes: e0f3b3e5c77a ("selftests: Add test cases for vlan_filter modification during runtime")
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > Cc: Dong Chenchen <dongchenchen2@huawei.com>  
> 
> Not sure if there is a way to replace the ifconfig in rtnetlink.sh.
> 
> Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
> 

Would this work:

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 2e8243a65b50..a3d3f2261bab 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -318,7 +318,7 @@ kci_test_promote_secondaries()
        for i in $(seq 2 254);do
                IP="10.23.11.$i"
                ip -f inet addr add $IP/16 brd + dev "$devdummy"
-               ifconfig "$devdummy" $IP netmask 255.255.0.0
+               ip addr add dev "$devdummy" $IP/16
        done
 
        ip addr flush dev "$devdummy"

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] selftests: avoid using ifconfig
  2025-07-30 14:51   ` Stephen Hemminger
@ 2025-07-31  1:16     ` Hangbin Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2025-07-31  1:16 UTC (permalink / raw)
  To: Stephen Hemminger, Florian Westphal
  Cc: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev, eric.dumazet, Dong Chenchen

On Wed, Jul 30, 2025 at 07:51:39AM -0700, Stephen Hemminger wrote:
> On Wed, 30 Jul 2025 12:56:19 +0000
> Hangbin Liu <liuhangbin@gmail.com> wrote:
> 
> > On Wed, Jul 30, 2025 at 11:53:13AM +0000, Eric Dumazet wrote:
> > > ifconfig is deprecated and not always present, use ip command instead.
> > > 
> > > Fixes: e0f3b3e5c77a ("selftests: Add test cases for vlan_filter modification during runtime")
> > > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > > Cc: Dong Chenchen <dongchenchen2@huawei.com>  
> > 
> > Not sure if there is a way to replace the ifconfig in rtnetlink.sh.
> > 
> > Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
> > 
> 
> Would this work:

From Florian's commit description, the ifconfig could trigger infinite
loop/soft lockup. I'm wondering if "ip" cmd able to trigger the same issue.

6a9e9cea4c51 ("net: ipv4: fix infinite loop on secondary addr promotion")
bb2bd090854c ("selftests: rtnetlink: add small test case with 'promote_secondaries' enabled")

Thanks
Hangbin
> 
> diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
> index 2e8243a65b50..a3d3f2261bab 100755
> --- a/tools/testing/selftests/net/rtnetlink.sh
> +++ b/tools/testing/selftests/net/rtnetlink.sh
> @@ -318,7 +318,7 @@ kci_test_promote_secondaries()
>         for i in $(seq 2 254);do
>                 IP="10.23.11.$i"
>                 ip -f inet addr add $IP/16 brd + dev "$devdummy"
> -               ifconfig "$devdummy" $IP netmask 255.255.0.0
> +               ip addr add dev "$devdummy" $IP/16
>         done
>  
>         ip addr flush dev "$devdummy"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] selftests: avoid using ifconfig
  2025-07-30 11:53 [PATCH net] selftests: avoid using ifconfig Eric Dumazet
  2025-07-30 12:56 ` Hangbin Liu
@ 2025-08-02  0:14 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-02  0:14 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuba, pabeni, horms, netdev, eric.dumazet, dongchenchen2

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 30 Jul 2025 11:53:13 +0000 you wrote:
> ifconfig is deprecated and not always present, use ip command instead.
> 
> Fixes: e0f3b3e5c77a ("selftests: Add test cases for vlan_filter modification during runtime")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Dong Chenchen <dongchenchen2@huawei.com>
> ---
>  tools/testing/selftests/net/vlan_hw_filter.sh | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)

Here is the summary with links:
  - [net] selftests: avoid using ifconfig
    https://git.kernel.org/netdev/net/c/7cbd49795d4c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-02  0:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-30 11:53 [PATCH net] selftests: avoid using ifconfig Eric Dumazet
2025-07-30 12:56 ` Hangbin Liu
2025-07-30 14:51   ` Stephen Hemminger
2025-07-31  1:16     ` Hangbin Liu
2025-08-02  0:14 ` patchwork-bot+netdevbpf

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).