[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251009210903.1055187-6-jvaclav@redhat.com>
Date: Thu, 9 Oct 2025 23:09:08 +0200
From: Jan Vaclav <jvaclav@...hat.com>
To: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Simon Horman <horms@...nel.org>,
Jakub Kicinski <kuba@...nel.org>
Cc: Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org,
Jan Vaclav <jvaclav@...hat.com>
Subject: [PATCH v3 net-next] 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/20250922093743.1347351-3-jvaclav@redhat.com/
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..4461adf69 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;
+ 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;
--
2.51.0
Powered by blists - more mailing lists