Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/hsr: add interlink to fill_info output

Currently, it is possible to configure the interlink
port, but no way to read it back from userspace.

Add it to the output of hsr_fill_info(), so it can be
read from userspace, for example:

$ ip -d link show hsr0
12: hsr0: <BROADCAST,MULTICAST> mtu ...
...
hsr slave1 veth0 slave2 veth1 interlink veth2 ...

Signed-off-by: Jan Vaclav <jvaclav@redhat.com>
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://patch.msgid.link/20251015101001.25670-2-jvaclav@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jan Vaclav and committed by
Jakub Kicinski
f18c231f e1048520

+6
+6
net/hsr/hsr_netlink.c
··· 160 160 goto nla_put_failure; 161 161 } 162 162 163 + port = hsr_port_get_hsr(hsr, HSR_PT_INTERLINK); 164 + if (port) { 165 + if (nla_put_u32(skb, IFLA_HSR_INTERLINK, port->dev->ifindex)) 166 + goto nla_put_failure; 167 + } 168 + 163 169 if (nla_put(skb, IFLA_HSR_SUPERVISION_ADDR, ETH_ALEN, 164 170 hsr->sup_multicast_addr) || 165 171 nla_put_u16(skb, IFLA_HSR_SEQ_NR, hsr->sequence_nr))