* [PATCH net-next] selftests: rtnetlink: Add operational state test
@ 2025-07-17 12:51 Ido Schimmel
2025-07-18 14:24 ` Simon Horman
2025-07-19 0:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Ido Schimmel @ 2025-07-17 12:51 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, pabeni, edumazet, petrm, horms, Ido Schimmel
Virtual devices (e.g., VXLAN) that do not have a notion of a carrier are
created with an "UNKNOWN" operational state which some users find
confusing [1].
It is possible to set the operational state from user space either
during device creation or afterwards and some applications will start
doing that in order to avoid the above problem.
Add a test for this functionality to ensure it does not regress.
[1] https://lore.kernel.org/netdev/20241119153703.71f97b76@hermes.local/
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
tools/testing/selftests/net/rtnetlink.sh | 34 ++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 49141254065c..441b17947230 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -30,6 +30,7 @@ ALL_TESTS="
kci_test_address_proto
kci_test_enslave_bonding
kci_test_mngtmpaddr
+ kci_test_operstate
"
devdummy="test-dummy0"
@@ -1344,6 +1345,39 @@ kci_test_mngtmpaddr()
return $ret
}
+kci_test_operstate()
+{
+ local ret=0
+
+ # Check that it is possible to set operational state during device
+ # creation and that it is preserved when the administrative state of
+ # the device is toggled.
+ run_cmd ip link add name vx0 up state up type vxlan id 10010 dstport 4789
+ run_cmd_grep "state UP" ip link show dev vx0
+ run_cmd ip link set dev vx0 down
+ run_cmd_grep "state DOWN" ip link show dev vx0
+ run_cmd ip link set dev vx0 up
+ run_cmd_grep "state UP" ip link show dev vx0
+
+ run_cmd ip link del dev vx0
+
+ # Check that it is possible to set the operational state of the device
+ # after creation.
+ run_cmd ip link add name vx0 up type vxlan id 10010 dstport 4789
+ run_cmd_grep "state UNKNOWN" ip link show dev vx0
+ run_cmd ip link set dev vx0 state up
+ run_cmd_grep "state UP" ip link show dev vx0
+
+ run_cmd ip link del dev vx0
+
+ if [ "$ret" -ne 0 ]; then
+ end_test "FAIL: operstate"
+ return 1
+ fi
+
+ end_test "PASS: operstate"
+}
+
kci_test_rtnl()
{
local current_test
--
2.50.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] selftests: rtnetlink: Add operational state test
2025-07-17 12:51 [PATCH net-next] selftests: rtnetlink: Add operational state test Ido Schimmel
@ 2025-07-18 14:24 ` Simon Horman
2025-07-19 0:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-07-18 14:24 UTC (permalink / raw)
To: Ido Schimmel; +Cc: netdev, davem, kuba, pabeni, edumazet, petrm
On Thu, Jul 17, 2025 at 03:51:51PM +0300, Ido Schimmel wrote:
> Virtual devices (e.g., VXLAN) that do not have a notion of a carrier are
> created with an "UNKNOWN" operational state which some users find
> confusing [1].
>
> It is possible to set the operational state from user space either
> during device creation or afterwards and some applications will start
> doing that in order to avoid the above problem.
>
> Add a test for this functionality to ensure it does not regress.
>
> [1] https://lore.kernel.org/netdev/20241119153703.71f97b76@hermes.local/
>
> Reviewed-by: Petr Machata <petrm@nvidia.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] selftests: rtnetlink: Add operational state test
2025-07-17 12:51 [PATCH net-next] selftests: rtnetlink: Add operational state test Ido Schimmel
2025-07-18 14:24 ` Simon Horman
@ 2025-07-19 0:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-19 0:40 UTC (permalink / raw)
To: Ido Schimmel; +Cc: netdev, davem, kuba, pabeni, edumazet, petrm, horms
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 17 Jul 2025 15:51:51 +0300 you wrote:
> Virtual devices (e.g., VXLAN) that do not have a notion of a carrier are
> created with an "UNKNOWN" operational state which some users find
> confusing [1].
>
> It is possible to set the operational state from user space either
> during device creation or afterwards and some applications will start
> doing that in order to avoid the above problem.
>
> [...]
Here is the summary with links:
- [net-next] selftests: rtnetlink: Add operational state test
https://git.kernel.org/netdev/net-next/c/25250f40e2a9
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] 3+ messages in thread
end of thread, other threads:[~2025-07-19 0:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17 12:51 [PATCH net-next] selftests: rtnetlink: Add operational state test Ido Schimmel
2025-07-18 14:24 ` Simon Horman
2025-07-19 0:40 ` 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).