netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net/hsr: add protocol version to fill_info output
@ 2025-09-22  9:37 Jan Vaclav
  2025-09-23  7:22 ` Simon Horman
  2025-09-24  0:06 ` Jakub Kicinski
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Vaclav @ 2025-09-22  9:37 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, 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().

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

Signed-off-by: Jan Vaclav <jvaclav@redhat.com>
---
v2: Added an example to the commit message to show
    how userspace programs could use this property.

v1: https://lore.kernel.org/netdev/20250918125337.111641-2-jvaclav@redhat.com/

 net/hsr/hsr_netlink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
index b12047024..3d0bd24c6 100644
--- a/net/hsr/hsr_netlink.c
+++ b/net/hsr/hsr_netlink.c
@@ -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;
+	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;
 
-- 
2.51.0


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

end of thread, other threads:[~2025-09-26  9:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-22  9:37 [PATCH v2 net-next] net/hsr: add protocol version to fill_info output Jan Vaclav
2025-09-23  7:22 ` Simon Horman
2025-09-24  0:06 ` Jakub Kicinski
2025-09-24 11:21   ` Ján Václav
2025-09-24 12:01     ` Fernando Fernandez Mancera
2025-09-24 23:40     ` Jakub Kicinski
2025-09-25  8:37       ` Fernando Fernandez Mancera
2025-09-26  2:00         ` Jakub Kicinski
2025-09-26  9:33           ` Fernando Fernandez Mancera

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