Skip to contentSkip to conversation

selftests: avoid using ifconfig

PATCH Applied Eric Dumazet 4 participants 5 messages Jul 30, 2025 – Aug 2, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: avoid using ifconfig

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

Fixes e0f3b3e5c77a ("selftests: Add test cases for vlan_filter modification during runtime")
Cc Dong Chenchen <[email protected]>
---
 tools/testing/selftests/net/vlan_hw_filter.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tools/testing/selftests/net/vlan_hw_filter.sh +8 -8
index 0fb56baf28e4a477ea68af1d8461f0ee82ca528d..e195d5cab6f75aa069b3952e850e73272b774a28 100755
@@ -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
 }
Signature · 1 line
2.50.1.552.g942d659e1b-goog
#2 lore raw
Quoted 11 lines · On Wed, 30 Jul 2025 12:56:19 +0000 Hangbin Liu <[email protected]> wrote:
Quoted 5 lines · Eric Dumazet

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

Fixes e0f3b3e5c77a ("selftests: Add test cases for vlan_filter modification during runtime")
Cc Dong Chenchen <[email protected]>

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

Would this work:

tools/testing/selftests/net/rtnetlink.sh +1 -1
index 2e8243a65b50..a3d3f2261bab 100755
@@ -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"
#3 lore raw
Quoted 10 lines · Stephen Hemminger
Quoted 7 lines · On Wed, 30 Jul 2025 12:56:19 +0000 Hangbin Liu <[email protected]> wrote:
Quoted 5 lines · Eric Dumazet

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

Fixes e0f3b3e5c77a ("selftests: Add test cases for vlan_filter modification during runtime")
Cc Dong Chenchen <[email protected]>
Quoted 6 lines
Quoted 4 lines

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

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

Quoted 14 lines
tools/testing/selftests/net/rtnetlink.sh +1 -1
index 2e8243a65b50..a3d3f2261bab 100755
@@ -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"
#4 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · 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")
Cc Dong Chenchen <[email protected]>
---
 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html