Hi,
This patch improves portability of the rtnetlink selftests in two ways:
1. It wraps a call to ifconfig in a presence check to avoid test failures on systems where ifconfig is not installed — such as default Debian Bookworm and newer distributions where iproute2 is the norm.
2. It skips the do_test_address_proto test if the installed version of iproute2 does not support the proto in ip address commands. Without this check, the test fails unconditionally on older iproute2 versions, even though the kernel functionality under test is not the culprit.
Both changes ensure that the test suite degrades gracefully by reporting SKIP instead of FAIL on incompatible systems.
Tested on Debian Bookworm with iproute2 6.1.0 and without ifconfig.
Thanks for your time and consideration.
Best regards, Alessandro Ratti
On systems where `ifconfig` is not available (e.g., modern Debian), the `kci_test_promote_secondaries` test fails. Wrap the call in a check.
Additionally, `do_test_address_proto` fails on iproute2 versions that lack support for `proto` in `ip address` commands. Add a minimal feature check and skip the test with a proper message if unsupported.
These changes allow the tests to run and report SKIP instead of FAIL on platforms with older tools.
Signed-off-by: Alessandro Ratti alessandro@0x65c.net --- tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..9bff620ef595 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -330,7 +330,9 @@ 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 + if command -v ifconfig >/dev/null 2>&1; then + ifconfig "$devdummy" $IP netmask 255.255.0.0 + fi done
ip addr flush dev "$devdummy" @@ -1201,6 +1203,12 @@ do_test_address_proto() local ret=0 local err
+ run_cmd_grep 'proto' ip address help + if [ $? -ne 0 ];then + end_test "SKIP: addr proto ${what}: iproute2 too old" + return $ksft_skip + fi + ip address add dev "$devdummy" "$addr3" check_err $? proto=$(address_get_proto "$addr3")
On Thu, Aug 21, 2025 at 09:43:11AM +0200, Alessandro Ratti wrote:
On systems where `ifconfig` is not available (e.g., modern Debian), the `kci_test_promote_secondaries` test fails. Wrap the call in a check.
Additionally, `do_test_address_proto` fails on iproute2 versions that lack support for `proto` in `ip address` commands. Add a minimal feature check and skip the test with a proper message if unsupported.
These changes allow the tests to run and report SKIP instead of FAIL on platforms with older tools.
Signed-off-by: Alessandro Ratti alessandro@0x65c.net
tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..9bff620ef595 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -330,7 +330,9 @@ 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
if command -v ifconfig >/dev/null 2>&1; then
ifconfig "$devdummy" $IP netmask 255.255.0.0
fi
Maybe just skip the promote_secondaries test if ifconfig is not available?
Hangbin
done ip addr flush dev "$devdummy" @@ -1201,6 +1203,12 @@ do_test_address_proto() local ret=0 local err
- run_cmd_grep 'proto' ip address help
- if [ $? -ne 0 ];then
end_test "SKIP: addr proto ${what}: iproute2 too old"
return $ksft_skip
- fi
- ip address add dev "$devdummy" "$addr3" check_err $? proto=$(address_get_proto "$addr3")
-- 2.39.5
On Thu, 21 Aug 2025 at 10:25, Hangbin Liu liuhangbin@gmail.com wrote:
On Thu, Aug 21, 2025 at 09:43:11AM +0200, Alessandro Ratti wrote:
On systems where `ifconfig` is not available (e.g., modern Debian), the `kci_test_promote_secondaries` test fails. Wrap the call in a check.
Additionally, `do_test_address_proto` fails on iproute2 versions that lack support for `proto` in `ip address` commands. Add a minimal feature check and skip the test with a proper message if unsupported.
These changes allow the tests to run and report SKIP instead of FAIL on platforms with older tools.
Signed-off-by: Alessandro Ratti alessandro@0x65c.net
tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..9bff620ef595 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -330,7 +330,9 @@ 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
if command -v ifconfig >/dev/null 2>&1; then
ifconfig "$devdummy" $IP netmask 255.255.0.0
fi
Maybe just skip the promote_secondaries test if ifconfig is not available?
Thank you for your review and comment.
My takeaway here is that the test works because the IP addresses are set on the $devdummy by the previous ip(8) command, and ifconfig seems a bit redundant.
Also, considering we are testing netlink, I was baffled to see ifconfig there that, if I'm not mistaken, uses ioctl(); but I might be missing something obvious here, considering I'm looking at these tests for the first time, so bear with me :)
If it's better to skip the test altogether when ifconfig is missing, I'll submit another patch to do so.
Thank you
Best regards, Alessandro
On Thu, Aug 21, 2025 at 10:45:19AM +0200, Alessandro wrote:
On Thu, 21 Aug 2025 at 10:25, Hangbin Liu liuhangbin@gmail.com wrote:
On Thu, Aug 21, 2025 at 09:43:11AM +0200, Alessandro Ratti wrote:
On systems where `ifconfig` is not available (e.g., modern Debian), the `kci_test_promote_secondaries` test fails. Wrap the call in a check.
Additionally, `do_test_address_proto` fails on iproute2 versions that lack support for `proto` in `ip address` commands. Add a minimal feature check and skip the test with a proper message if unsupported.
These changes allow the tests to run and report SKIP instead of FAIL on platforms with older tools.
Signed-off-by: Alessandro Ratti alessandro@0x65c.net
tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..9bff620ef595 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -330,7 +330,9 @@ 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
if command -v ifconfig >/dev/null 2>&1; then
ifconfig "$devdummy" $IP netmask 255.255.0.0
fi
Maybe just skip the promote_secondaries test if ifconfig is not available?
Thank you for your review and comment.
My takeaway here is that the test works because the IP addresses are set on the $devdummy by the previous ip(8) command, and ifconfig seems a bit redundant.
No, please check the git log to see why we use ifconfig here.
Thanks Hangbin
Also, considering we are testing netlink, I was baffled to see ifconfig there that, if I'm not mistaken, uses ioctl(); but I might be missing something obvious here, considering I'm looking at these tests for the first time, so bear with me :)
If it's better to skip the test altogether when ifconfig is missing, I'll submit another patch to do so.
Thank you
Best regards, Alessandro
On Thu, 21 Aug 2025 at 10:59, Hangbin Liu liuhangbin@gmail.com wrote:
On Thu, Aug 21, 2025 at 10:45:19AM +0200, Alessandro wrote:
On Thu, 21 Aug 2025 at 10:25, Hangbin Liu liuhangbin@gmail.com wrote:
On Thu, Aug 21, 2025 at 09:43:11AM +0200, Alessandro Ratti wrote:
On systems where `ifconfig` is not available (e.g., modern Debian), the `kci_test_promote_secondaries` test fails. Wrap the call in a check.
Additionally, `do_test_address_proto` fails on iproute2 versions that lack support for `proto` in `ip address` commands. Add a minimal feature check and skip the test with a proper message if unsupported.
These changes allow the tests to run and report SKIP instead of FAIL on platforms with older tools.
Signed-off-by: Alessandro Ratti alessandro@0x65c.net
tools/testing/selftests/net/rtnetlink.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..9bff620ef595 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -330,7 +330,9 @@ 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
if command -v ifconfig >/dev/null 2>&1; then
ifconfig "$devdummy" $IP netmask 255.255.0.0
fi
Maybe just skip the promote_secondaries test if ifconfig is not available?
Thank you for your review and comment.
My takeaway here is that the test works because the IP addresses are set on the $devdummy by the previous ip(8) command, and ifconfig seems a bit redundant.
No, please check the git log to see why we use ifconfig here.
Ah! I see your point now. That said, yes, better skip the test if ifconfig isn't installed. I'll send out a new patch.
Thank you Alessandro
Hi,
Following up on Hangbin's comment, here is the updated patch with adjustments to skip tests gracefully when missing tools and iproute2 capabilities.
Thanks for your time and consideration.
Best regards, Alessandro Ratti
Some rtnetlink selftests assume the presence of ifconfig and iproute2 support for the `proto` keyword in `ip address` commands. These assumptions can cause test failures on modern systems (e.g. Debian Bookworm) where:
- ifconfig is not installed by default - The iproute2 version lacks support for address protocol
This patch improves test robustness by:
- Skipping kci_test_promote_secondaries if ifconfig is missing - Skipping do_test_address_proto if ip address help does not mention proto
These changes ensure the tests degrade gracefully by reporting SKIP instead of FAIL when prerequisites are not met, improving portability across systems.
Signed-off-by: Alessandro Ratti alessandro@0x65c.net --- tools/testing/selftests/net/rtnetlink.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..c2a0e7f37391 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -323,6 +323,11 @@ kci_test_addrlft()
kci_test_promote_secondaries() { + run_cmd ifconfig "$devdummy" + if [ $ret -ne 0 ]; then + end_test "SKIP: ifconfig not installed" + return $ksft_skip + fi promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1 @@ -1201,6 +1206,12 @@ do_test_address_proto() local ret=0 local err
+ run_cmd_grep 'proto' ip address help + if [ $? -ne 0 ];then + end_test "SKIP: addr proto ${what}: iproute2 too old" + return $ksft_skip + fi + ip address add dev "$devdummy" "$addr3" check_err $? proto=$(address_get_proto "$addr3")
On Thu, Aug 21, 2025 at 04:16:51PM +0200, Alessandro Ratti wrote:
Some rtnetlink selftests assume the presence of ifconfig and iproute2 support for the `proto` keyword in `ip address` commands. These assumptions can cause test failures on modern systems (e.g. Debian Bookworm) where:
- ifconfig is not installed by default
- The iproute2 version lacks support for address protocol
This patch improves test robustness by:
- Skipping kci_test_promote_secondaries if ifconfig is missing
- Skipping do_test_address_proto if ip address help does not mention proto
These changes ensure the tests degrade gracefully by reporting SKIP instead of FAIL when prerequisites are not met, improving portability across systems.
Signed-off-by: Alessandro Ratti alessandro@0x65c.net
tools/testing/selftests/net/rtnetlink.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..c2a0e7f37391 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -323,6 +323,11 @@ kci_test_addrlft() kci_test_promote_secondaries() {
- run_cmd ifconfig "$devdummy"
- if [ $ret -ne 0 ]; then
end_test "SKIP: ifconfig not installed"
return $ksft_skip
- fi promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1 @@ -1201,6 +1206,12 @@ do_test_address_proto() local ret=0 local err
- run_cmd_grep 'proto' ip address help
- if [ $? -ne 0 ];then
end_test "SKIP: addr proto ${what}: iproute2 too old"
return $ksft_skip
- fi
- ip address add dev "$devdummy" "$addr3" check_err $? proto=$(address_get_proto "$addr3")
-- 2.39.5
Hi Alessandro,
Next time, please add the version tag and target branch in the subject. e.g. [PATCHv2 net-next] your subject
I'm not sure if the lack of a version number will have an impact on the patch work.
The change looks good to me.
Reviewed-by: Hangbin Liu liuhangbin@gmail.com
On Fri, 22 Aug 2025 at 03:09, Hangbin Liu liuhangbin@gmail.com wrote:
Hi Alessandro,
Next time, please add the version tag and target branch in the subject. e.g. [PATCHv2 net-next] your subject
I'm not sure if the lack of a version number will have an impact on the patch work.
The change looks good to me.
Reviewed-by: Hangbin Liu liuhangbin@gmail.com
Hi Hangbin,
Thank you again for the review and for pointing out the correct subject format.
Apologies for the oversight — I’ve updated the patch accordingly and am re-sending it with the correct subject line and the Reviewed-by tag.
Lesson learned for next time :)
Best regards, Alessandro
Some rtnetlink selftests assume the presence of ifconfig and iproute2 support for the `proto` keyword in `ip address` commands. These assumptions can cause test failures on modern systems (e.g. Debian Bookworm) where:
- ifconfig is not installed by default - The iproute2 version lacks support for address protocol
This patch improves test robustness by:
- Skipping kci_test_promote_secondaries if ifconfig is missing - Skipping do_test_address_proto if ip address help does not mention proto
These changes ensure the tests degrade gracefully by reporting SKIP instead of FAIL when prerequisites are not met, improving portability across systems.
Signed-off-by: Alessandro Ratti alessandro@0x65c.net
--- v2: - Updated the patch based on review from Hangbin Liu - Changed subject and commit message to better reflect updated behavior - Added Reviewed-by tag
Reviewed-by: Hangbin Liu liuhangbin@gmail.com --- tools/testing/selftests/net/rtnetlink.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..c2a0e7f37391 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -323,6 +323,11 @@ kci_test_addrlft()
kci_test_promote_secondaries() { + run_cmd ifconfig "$devdummy" + if [ $ret -ne 0 ]; then + end_test "SKIP: ifconfig not installed" + return $ksft_skip + fi promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1 @@ -1201,6 +1206,12 @@ do_test_address_proto() local ret=0 local err
+ run_cmd_grep 'proto' ip address help + if [ $? -ne 0 ];then + end_test "SKIP: addr proto ${what}: iproute2 too old" + return $ksft_skip + fi + ip address add dev "$devdummy" "$addr3" check_err $? proto=$(address_get_proto "$addr3")
On Fri, Aug 22, 2025 at 02:08:42PM +0200, Alessandro Ratti wrote:
Some rtnetlink selftests assume the presence of ifconfig and iproute2 support for the `proto` keyword in `ip address` commands. These assumptions can cause test failures on modern systems (e.g. Debian Bookworm) where:
- ifconfig is not installed by default
- The iproute2 version lacks support for address protocol
This patch improves test robustness by:
- Skipping kci_test_promote_secondaries if ifconfig is missing
- Skipping do_test_address_proto if ip address help does not mention proto
These changes ensure the tests degrade gracefully by reporting SKIP instead of FAIL when prerequisites are not met, improving portability across systems.
The Reviewed-by tag should be here
Reviewed-by: Hangbin Liu liuhangbin@gmail.com
Signed-off-by: Alessandro Ratti alessandro@0x65c.net
v2:
- Updated the patch based on review from Hangbin Liu
- Changed subject and commit message to better reflect updated behavior
- Added Reviewed-by tag
Reviewed-by: Hangbin Liu liuhangbin@gmail.com
tools/testing/selftests/net/rtnetlink.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..c2a0e7f37391 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -323,6 +323,11 @@ kci_test_addrlft() kci_test_promote_secondaries() {
- run_cmd ifconfig "$devdummy"
- if [ $ret -ne 0 ]; then
end_test "SKIP: ifconfig not installed"
return $ksft_skip
- fi promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1 @@ -1201,6 +1206,12 @@ do_test_address_proto() local ret=0 local err
- run_cmd_grep 'proto' ip address help
- if [ $? -ne 0 ];then
end_test "SKIP: addr proto ${what}: iproute2 too old"
return $ksft_skip
- fi
- ip address add dev "$devdummy" "$addr3" check_err $? proto=$(address_get_proto "$addr3")
-- 2.39.5
On Fri, 22 Aug 2025 at 15:03, Hangbin Liu liuhangbin@gmail.com wrote:
The Reviewed-by tag should be here
Reviewed-by: Hangbin Liu liuhangbin@gmail.com
Thanks again for your feedback on the previous version.
This is v3 of the patch, with the `Reviewed-by:` tag now correctly placed above the `Signed-off-by:` line as per your suggestion.
Changelog: v3: - Moved Reviewed-by tag above Signed-off-by tag
Best regards, Alessandro
Some rtnetlink selftests assume the presence of ifconfig and iproute2 support for the `proto` keyword in `ip address` commands. These assumptions can cause test failures on modern systems (e.g. Debian Bookworm) where:
- ifconfig is not installed by default - The iproute2 version lacks support for address protocol
This patch improves test robustness by:
- Skipping kci_test_promote_secondaries if ifconfig is missing - Skipping do_test_address_proto if ip address help does not mention proto
These changes ensure the tests degrade gracefully by reporting SKIP instead of FAIL when prerequisites are not met, improving portability across systems.
Reviewed-by: Hangbin Liu liuhangbin@gmail.com
Signed-off-by: Alessandro Ratti alessandro@0x65c.net
--- v2: - Updated the patch based on review from Hangbin Liu - Changed subject and commit message to better reflect updated behavior - Added Reviewed-by tag
v3: - Amend Reviewed-by tag position --- tools/testing/selftests/net/rtnetlink.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index d6c00efeb664..c2a0e7f37391 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -323,6 +323,11 @@ kci_test_addrlft()
kci_test_promote_secondaries() { + run_cmd ifconfig "$devdummy" + if [ $ret -ne 0 ]; then + end_test "SKIP: ifconfig not installed" + return $ksft_skip + fi promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1 @@ -1201,6 +1206,12 @@ do_test_address_proto() local ret=0 local err
+ run_cmd_grep 'proto' ip address help + if [ $? -ne 0 ];then + end_test "SKIP: addr proto ${what}: iproute2 too old" + return $ksft_skip + fi + ip address add dev "$devdummy" "$addr3" check_err $? proto=$(address_get_proto "$addr3")
On Fri, 22 Aug 2025 16:03:39 +0200 Alessandro Ratti wrote:
Thanks again for your feedback on the previous version.
This is v3 of the patch, with the `Reviewed-by:` tag now correctly placed above the `Signed-off-by:` line as per your suggestion.
Do me a favor and read this please: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
linux-kselftest-mirror@lists.linaro.org