Skip to contentSkip to conversation

net/hsr: add protocol version to fill_info output

PATCH Applied Jan Vaclav 4 participants 5 messages Oct 14, 2025

Subsystems (3)
lore
Share & tools
lore

Jan Vaclav

author
#0 lore raw

PATCH v3 1/1 net/hsr: add protocol version to fill_info output

Currently, it is possible to configure IFLA_HSR_VERSION, but there is no way to check in userspace what the currently configured HSR protocol version is.

Add it to the output of hsr_fill_info(), when the interface is using the HSR protocol. Let's not expose it when using the PRP protocol, since it only has one version and it's not possible to set it from userspace.

This info could then be used by e.g. ip(8), like so:

$ ip -d link show hsr0
12: hsr0: <BROADCAST,MULTICAST> mtu ...
    ...
    hsr slave1 veth0 slave2 veth1 ... proto 0 version 1
---
v3: Changed after discussion so that IFLA_HSR_VERSION is filled
    only when the protocol is HSR (and not PRP, since setting
    the version is prohibited if the protocol is PRP).

v2: https://lore.kernel.org/netdev/[email protected]/

v1: https://lore.kernel.org/netdev/[email protected]/

 net/hsr/hsr_netlink.c | 2 ++
 1 file changed, 2 insertions(+)
net/hsr/hsr_netlink.c +2 -0
index b12047024..4461adf69 100644
@@ -166,6 +166,8 @@ static int hsr_fill_info(struct sk_buff *skb, const struct net_device *dev)
 		goto nla_put_failure;
 	if (hsr->prot_version == PRP_V1)
 		proto = HSR_PROTOCOL_PRP;
+	else if (nla_put_u8(skb, IFLA_HSR_VERSION, hsr->prot_version))
+		goto nla_put_failure;
 	if (nla_put_u8(skb, IFLA_HSR_PROTOCOL, proto))
 		goto nla_put_failure;
 
Signature · 1 line
2.51.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 9 lines · Jan Vaclav

Currently, it is possible to configure IFLA_HSR_VERSION, but there is no way to check in userspace what the currently configured HSR protocol version is.

Add it to the output of hsr_fill_info(), when the interface is using the HSR protocol. Let's not expose it when using the PRP protocol, since it only has one version and it's not possible to set it from userspace.

Quoted 5 lines

This info could then be used by e.g. ip(8), like so:

$ ip -d link show hsr0
12: hsr0: <BROADCAST,MULTICAST> mtu ...
     ...
     hsr slave1 veth0 slave2 veth1 ... proto 0 version 1

I think this is missing the 'Signed-off-by' tag. Other than that, it looks good to me. Not sure if it can be added while merging.

author
#2 lore raw
Quoted 16 lines · Fernando Fernandez Mancera
Quoted 9 lines · Jan Vaclav

Currently, it is possible to configure IFLA_HSR_VERSION, but there is no way to check in userspace what the currently configured HSR protocol version is.

Add it to the output of hsr_fill_info(), when the interface is using the HSR protocol. Let's not expose it when using the PRP protocol, since it only has one version and it's not possible to set it from userspace.

Quoted 5 lines

This info could then be used by e.g. ip(8), like so:

$ ip -d link show hsr0
12: hsr0: <BROADCAST,MULTICAST> mtu ...
     ...
     hsr slave1 veth0 slave2 veth1 ... proto 0 version 1
Quoted 4 lines

I think this is missing the 'Signed-off-by' tag. Other than that, it looks good to me. Not sure if it can be added while merging.

Yes, it looks like I dropped my signoff somewhere along the way, my apologies. If it's possible to add it while merging, please consider this patch as:

Reviewed-by on v3 1/1
#3 lore raw
In reply to Jan Vaclav
Quoted 9 lines · Jan Vaclav

Currently, it is possible to configure IFLA_HSR_VERSION, but there is no way to check in userspace what the currently configured HSR protocol version is.

Add it to the output of hsr_fill_info(), when the interface is using the HSR protocol. Let's not expose it when using the PRP protocol, since it only has one version and it's not possible to set it from userspace.

Quoted 6 lines

This info could then be used by e.g. ip(8), like so:

$ ip -d link show hsr0
12: hsr0: <BROADCAST,MULTICAST> mtu ...
    ...
    hsr slave1 veth0 slave2 veth1 ... proto 0 version 1
---

Patchwork probably accepted your delayed Signed-off-by, so this might be accepted as is. But please wait 3 days and if you don't see a merge email, resubmit.

Andrew

#4 lore raw
In reply to Jan Vaclav
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 10 lines · On Thu, 9 Oct 2025 23:09:08 +0200 you wrote:

Currently, it is possible to configure IFLA_HSR_VERSION, but there is no way to check in userspace what the currently configured HSR protocol version is.

Add it to the output of hsr_fill_info(), when the interface is using the HSR protocol. Let's not expose it when using the PRP protocol, since it only has one version and it's not possible to set it from userspace.

[...]

Here is the summary with links:
- [v3,net-next] net/hsr: add protocol version to fill_info output

    https://git.kernel.org/netdev/net-next/c/16a2206354d1

You are awesome, thank you!

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