Murali Karicheri | 0e7623b | 2019-04-05 13:31:34 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 2 | /* Copyright 2011-2014 Autronica Fire and Security AS |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 3 | * |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 4 | * Author(s): |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 5 | * 2011-2014 Arvid Brodin, arvid.brodin@alten.se |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 6 | * |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 7 | * Routines for handling Netlink messages for HSR and PRP. |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include "hsr_netlink.h" |
| 11 | #include <linux/kernel.h> |
| 12 | #include <net/rtnetlink.h> |
| 13 | #include <net/genetlink.h> |
| 14 | #include "hsr_main.h" |
| 15 | #include "hsr_device.h" |
| 16 | #include "hsr_framereg.h" |
| 17 | |
| 18 | static const struct nla_policy hsr_policy[IFLA_HSR_MAX + 1] = { |
| 19 | [IFLA_HSR_SLAVE1] = { .type = NLA_U32 }, |
| 20 | [IFLA_HSR_SLAVE2] = { .type = NLA_U32 }, |
| 21 | [IFLA_HSR_MULTICAST_SPEC] = { .type = NLA_U8 }, |
Peter Heise | ee1c279 | 2016-04-13 13:52:22 +0200 | [diff] [blame] | 22 | [IFLA_HSR_VERSION] = { .type = NLA_U8 }, |
Peter Heise | f937572 | 2016-04-19 13:34:28 +0200 | [diff] [blame] | 23 | [IFLA_HSR_SUPERVISION_ADDR] = { .len = ETH_ALEN }, |
Arvid Brodin | 98bf836 | 2013-11-29 23:38:16 +0100 | [diff] [blame] | 24 | [IFLA_HSR_SEQ_NR] = { .type = NLA_U16 }, |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 25 | [IFLA_HSR_PROTOCOL] = { .type = NLA_U8 }, |
Lukasz Majewski | 5055ccc | 2024-04-23 14:49:04 +0200 | [diff] [blame] | 26 | [IFLA_HSR_INTERLINK] = { .type = NLA_U32 }, |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 27 | }; |
| 28 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 29 | /* Here, it seems a netdevice has already been allocated for us, and the |
| 30 | * hsr_dev_setup routine has been executed. Nice! |
| 31 | */ |
| 32 | static int hsr_newlink(struct net *src_net, struct net_device *dev, |
Matthias Schiffer | 7a3f4a1 | 2017-06-25 23:55:59 +0200 | [diff] [blame] | 33 | struct nlattr *tb[], struct nlattr *data[], |
| 34 | struct netlink_ext_ack *extack) |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 35 | { |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 36 | enum hsr_version proto_version; |
| 37 | unsigned char multicast_spec; |
| 38 | u8 proto = HSR_PROTOCOL_HSR; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 39 | |
Lukasz Majewski | 5055ccc | 2024-04-23 14:49:04 +0200 | [diff] [blame] | 40 | struct net_device *link[2], *interlink = NULL; |
Arvid Brodin | a718dcc | 2014-07-04 23:42:00 +0200 | [diff] [blame] | 41 | if (!data) { |
Taehee Yoo | 13eeb5f | 2020-02-28 18:01:35 +0000 | [diff] [blame] | 42 | NL_SET_ERR_MSG_MOD(extack, "No slave devices specified"); |
Arvid Brodin | a718dcc | 2014-07-04 23:42:00 +0200 | [diff] [blame] | 43 | return -EINVAL; |
| 44 | } |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 45 | if (!data[IFLA_HSR_SLAVE1]) { |
Taehee Yoo | 13eeb5f | 2020-02-28 18:01:35 +0000 | [diff] [blame] | 46 | NL_SET_ERR_MSG_MOD(extack, "Slave1 device not specified"); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 47 | return -EINVAL; |
| 48 | } |
Murali Karicheri | d595b85 | 2019-04-05 13:31:23 -0400 | [diff] [blame] | 49 | link[0] = __dev_get_by_index(src_net, |
| 50 | nla_get_u32(data[IFLA_HSR_SLAVE1])); |
Taehee Yoo | 13eeb5f | 2020-02-28 18:01:35 +0000 | [diff] [blame] | 51 | if (!link[0]) { |
| 52 | NL_SET_ERR_MSG_MOD(extack, "Slave1 does not exist"); |
| 53 | return -EINVAL; |
| 54 | } |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 55 | if (!data[IFLA_HSR_SLAVE2]) { |
Taehee Yoo | 13eeb5f | 2020-02-28 18:01:35 +0000 | [diff] [blame] | 56 | NL_SET_ERR_MSG_MOD(extack, "Slave2 device not specified"); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 57 | return -EINVAL; |
| 58 | } |
Murali Karicheri | d595b85 | 2019-04-05 13:31:23 -0400 | [diff] [blame] | 59 | link[1] = __dev_get_by_index(src_net, |
| 60 | nla_get_u32(data[IFLA_HSR_SLAVE2])); |
Taehee Yoo | 13eeb5f | 2020-02-28 18:01:35 +0000 | [diff] [blame] | 61 | if (!link[1]) { |
| 62 | NL_SET_ERR_MSG_MOD(extack, "Slave2 does not exist"); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 63 | return -EINVAL; |
Taehee Yoo | 13eeb5f | 2020-02-28 18:01:35 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | if (link[0] == link[1]) { |
| 67 | NL_SET_ERR_MSG_MOD(extack, "Slave1 and Slave2 are same"); |
| 68 | return -EINVAL; |
| 69 | } |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 70 | |
Lukasz Majewski | 5055ccc | 2024-04-23 14:49:04 +0200 | [diff] [blame] | 71 | if (data[IFLA_HSR_INTERLINK]) |
| 72 | interlink = __dev_get_by_index(src_net, |
| 73 | nla_get_u32(data[IFLA_HSR_INTERLINK])); |
| 74 | |
| 75 | if (interlink && interlink == link[0]) { |
| 76 | NL_SET_ERR_MSG_MOD(extack, "Interlink and Slave1 are the same"); |
| 77 | return -EINVAL; |
| 78 | } |
| 79 | |
| 80 | if (interlink && interlink == link[1]) { |
| 81 | NL_SET_ERR_MSG_MOD(extack, "Interlink and Slave2 are the same"); |
| 82 | return -EINVAL; |
| 83 | } |
| 84 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 85 | if (!data[IFLA_HSR_MULTICAST_SPEC]) |
| 86 | multicast_spec = 0; |
| 87 | else |
| 88 | multicast_spec = nla_get_u8(data[IFLA_HSR_MULTICAST_SPEC]); |
| 89 | |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 90 | if (data[IFLA_HSR_PROTOCOL]) |
| 91 | proto = nla_get_u8(data[IFLA_HSR_PROTOCOL]); |
| 92 | |
| 93 | if (proto >= HSR_PROTOCOL_MAX) { |
Ye Bin | b87f9fe | 2020-09-09 17:38:21 +0800 | [diff] [blame] | 94 | NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol"); |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 95 | return -EINVAL; |
| 96 | } |
| 97 | |
Taehee Yoo | 4faab8c | 2020-04-07 13:23:21 +0000 | [diff] [blame] | 98 | if (!data[IFLA_HSR_VERSION]) { |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 99 | proto_version = HSR_V0; |
Taehee Yoo | 4faab8c | 2020-04-07 13:23:21 +0000 | [diff] [blame] | 100 | } else { |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 101 | if (proto == HSR_PROTOCOL_PRP) { |
Ye Bin | b87f9fe | 2020-09-09 17:38:21 +0800 | [diff] [blame] | 102 | NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported"); |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 103 | return -EINVAL; |
| 104 | } |
| 105 | |
| 106 | proto_version = nla_get_u8(data[IFLA_HSR_VERSION]); |
| 107 | if (proto_version > HSR_V1) { |
Taehee Yoo | 4faab8c | 2020-04-07 13:23:21 +0000 | [diff] [blame] | 108 | NL_SET_ERR_MSG_MOD(extack, |
Ye Bin | b87f9fe | 2020-09-09 17:38:21 +0800 | [diff] [blame] | 109 | "Only HSR version 0/1 supported"); |
Taehee Yoo | 4faab8c | 2020-04-07 13:23:21 +0000 | [diff] [blame] | 110 | return -EINVAL; |
| 111 | } |
| 112 | } |
Peter Heise | ee1c279 | 2016-04-13 13:52:22 +0200 | [diff] [blame] | 113 | |
Lukasz Majewski | 5055ccc | 2024-04-23 14:49:04 +0200 | [diff] [blame] | 114 | if (proto == HSR_PROTOCOL_PRP) { |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 115 | proto_version = PRP_V1; |
Lukasz Majewski | 5055ccc | 2024-04-23 14:49:04 +0200 | [diff] [blame] | 116 | if (interlink) { |
| 117 | NL_SET_ERR_MSG_MOD(extack, |
| 118 | "Interlink only works with HSR"); |
| 119 | return -EINVAL; |
| 120 | } |
| 121 | } |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 122 | |
Lukasz Majewski | 5055ccc | 2024-04-23 14:49:04 +0200 | [diff] [blame] | 123 | return hsr_dev_finalize(dev, link, interlink, multicast_spec, |
| 124 | proto_version, extack); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 125 | } |
| 126 | |
Taehee Yoo | de0083c | 2020-06-21 13:46:25 +0000 | [diff] [blame] | 127 | static void hsr_dellink(struct net_device *dev, struct list_head *head) |
| 128 | { |
| 129 | struct hsr_priv *hsr = netdev_priv(dev); |
| 130 | |
| 131 | del_timer_sync(&hsr->prune_timer); |
Lukasz Majewski | 5055ccc | 2024-04-23 14:49:04 +0200 | [diff] [blame] | 132 | del_timer_sync(&hsr->prune_proxy_timer); |
Taehee Yoo | de0083c | 2020-06-21 13:46:25 +0000 | [diff] [blame] | 133 | del_timer_sync(&hsr->announce_timer); |
Lukasz Majewski | 5f703ce | 2024-06-10 15:39:14 +0200 | [diff] [blame] | 134 | timer_delete_sync(&hsr->announce_proxy_timer); |
Taehee Yoo | de0083c | 2020-06-21 13:46:25 +0000 | [diff] [blame] | 135 | |
| 136 | hsr_debugfs_term(hsr); |
| 137 | hsr_del_ports(hsr); |
| 138 | |
| 139 | hsr_del_self_node(hsr); |
Sebastian Andrzej Siewior | e012764 | 2022-11-29 17:48:08 +0100 | [diff] [blame] | 140 | hsr_del_nodes(&hsr->node_db); |
Lukasz Majewski | 5055ccc | 2024-04-23 14:49:04 +0200 | [diff] [blame] | 141 | hsr_del_nodes(&hsr->proxy_node_db); |
Taehee Yoo | de0083c | 2020-06-21 13:46:25 +0000 | [diff] [blame] | 142 | |
| 143 | unregister_netdevice_queue(dev, head); |
| 144 | } |
| 145 | |
Arvid Brodin | 98bf836 | 2013-11-29 23:38:16 +0100 | [diff] [blame] | 146 | static int hsr_fill_info(struct sk_buff *skb, const struct net_device *dev) |
| 147 | { |
Taehee Yoo | 81390d0 | 2020-02-28 18:01:56 +0000 | [diff] [blame] | 148 | struct hsr_priv *hsr = netdev_priv(dev); |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 149 | u8 proto = HSR_PROTOCOL_HSR; |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 150 | struct hsr_port *port; |
Arvid Brodin | 98bf836 | 2013-11-29 23:38:16 +0100 | [diff] [blame] | 151 | |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 152 | port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_A); |
Taehee Yoo | 81390d0 | 2020-02-28 18:01:56 +0000 | [diff] [blame] | 153 | if (port) { |
| 154 | if (nla_put_u32(skb, IFLA_HSR_SLAVE1, port->dev->ifindex)) |
| 155 | goto nla_put_failure; |
| 156 | } |
Arvid Brodin | 51f3c60 | 2014-07-04 23:37:27 +0200 | [diff] [blame] | 157 | |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 158 | port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B); |
Taehee Yoo | 81390d0 | 2020-02-28 18:01:56 +0000 | [diff] [blame] | 159 | if (port) { |
| 160 | if (nla_put_u32(skb, IFLA_HSR_SLAVE2, port->dev->ifindex)) |
| 161 | goto nla_put_failure; |
| 162 | } |
Arvid Brodin | 98bf836 | 2013-11-29 23:38:16 +0100 | [diff] [blame] | 163 | |
| 164 | if (nla_put(skb, IFLA_HSR_SUPERVISION_ADDR, ETH_ALEN, |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 165 | hsr->sup_multicast_addr) || |
| 166 | nla_put_u16(skb, IFLA_HSR_SEQ_NR, hsr->sequence_nr)) |
Arvid Brodin | 98bf836 | 2013-11-29 23:38:16 +0100 | [diff] [blame] | 167 | goto nla_put_failure; |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 168 | if (hsr->prot_version == PRP_V1) |
| 169 | proto = HSR_PROTOCOL_PRP; |
| 170 | if (nla_put_u8(skb, IFLA_HSR_PROTOCOL, proto)) |
| 171 | goto nla_put_failure; |
Arvid Brodin | 98bf836 | 2013-11-29 23:38:16 +0100 | [diff] [blame] | 172 | |
| 173 | return 0; |
| 174 | |
| 175 | nla_put_failure: |
| 176 | return -EMSGSIZE; |
| 177 | } |
| 178 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 179 | static struct rtnl_link_ops hsr_link_ops __read_mostly = { |
| 180 | .kind = "hsr", |
| 181 | .maxtype = IFLA_HSR_MAX, |
| 182 | .policy = hsr_policy, |
| 183 | .priv_size = sizeof(struct hsr_priv), |
| 184 | .setup = hsr_dev_setup, |
| 185 | .newlink = hsr_newlink, |
Taehee Yoo | de0083c | 2020-06-21 13:46:25 +0000 | [diff] [blame] | 186 | .dellink = hsr_dellink, |
Arvid Brodin | 98bf836 | 2013-11-29 23:38:16 +0100 | [diff] [blame] | 187 | .fill_info = hsr_fill_info, |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 188 | }; |
| 189 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 190 | /* attribute policy */ |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 191 | static const struct nla_policy hsr_genl_policy[HSR_A_MAX + 1] = { |
Peter Heise | f937572 | 2016-04-19 13:34:28 +0200 | [diff] [blame] | 192 | [HSR_A_NODE_ADDR] = { .len = ETH_ALEN }, |
| 193 | [HSR_A_NODE_ADDR_B] = { .len = ETH_ALEN }, |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 194 | [HSR_A_IFINDEX] = { .type = NLA_U32 }, |
| 195 | [HSR_A_IF1_AGE] = { .type = NLA_U32 }, |
| 196 | [HSR_A_IF2_AGE] = { .type = NLA_U32 }, |
| 197 | [HSR_A_IF1_SEQ] = { .type = NLA_U16 }, |
| 198 | [HSR_A_IF2_SEQ] = { .type = NLA_U16 }, |
| 199 | }; |
| 200 | |
Johannes Berg | 489111e | 2016-10-24 14:40:03 +0200 | [diff] [blame] | 201 | static struct genl_family hsr_genl_family; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 202 | |
Johannes Berg | 2a94fe4 | 2013-11-19 15:19:39 +0100 | [diff] [blame] | 203 | static const struct genl_multicast_group hsr_mcgrps[] = { |
| 204 | { .name = "hsr-network", }, |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 205 | }; |
| 206 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 207 | /* This is called if for some node with MAC address addr, we only get frames |
| 208 | * over one of the slave interfaces. This would indicate an open network ring |
| 209 | * (i.e. a link has failed somewhere). |
| 210 | */ |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 211 | void hsr_nl_ringerror(struct hsr_priv *hsr, unsigned char addr[ETH_ALEN], |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 212 | struct hsr_port *port) |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 213 | { |
| 214 | struct sk_buff *skb; |
| 215 | void *msg_head; |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 216 | struct hsr_port *master; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 217 | int res; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 218 | |
| 219 | skb = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); |
| 220 | if (!skb) |
| 221 | goto fail; |
| 222 | |
Murali Karicheri | d595b85 | 2019-04-05 13:31:23 -0400 | [diff] [blame] | 223 | msg_head = genlmsg_put(skb, 0, 0, &hsr_genl_family, 0, |
| 224 | HSR_C_RING_ERROR); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 225 | if (!msg_head) |
| 226 | goto nla_put_failure; |
| 227 | |
| 228 | res = nla_put(skb, HSR_A_NODE_ADDR, ETH_ALEN, addr); |
| 229 | if (res < 0) |
| 230 | goto nla_put_failure; |
| 231 | |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 232 | res = nla_put_u32(skb, HSR_A_IFINDEX, port->dev->ifindex); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 233 | if (res < 0) |
| 234 | goto nla_put_failure; |
| 235 | |
| 236 | genlmsg_end(skb, msg_head); |
Johannes Berg | 2a94fe4 | 2013-11-19 15:19:39 +0100 | [diff] [blame] | 237 | genlmsg_multicast(&hsr_genl_family, skb, 0, 0, GFP_ATOMIC); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 238 | |
| 239 | return; |
| 240 | |
| 241 | nla_put_failure: |
| 242 | kfree_skb(skb); |
| 243 | |
| 244 | fail: |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 245 | rcu_read_lock(); |
| 246 | master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); |
| 247 | netdev_warn(master->dev, "Could not send HSR ring error message\n"); |
| 248 | rcu_read_unlock(); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | /* This is called when we haven't heard from the node with MAC address addr for |
| 252 | * some time (just before the node is removed from the node table/list). |
| 253 | */ |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 254 | void hsr_nl_nodedown(struct hsr_priv *hsr, unsigned char addr[ETH_ALEN]) |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 255 | { |
| 256 | struct sk_buff *skb; |
| 257 | void *msg_head; |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 258 | struct hsr_port *master; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 259 | int res; |
| 260 | |
| 261 | skb = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); |
| 262 | if (!skb) |
| 263 | goto fail; |
| 264 | |
| 265 | msg_head = genlmsg_put(skb, 0, 0, &hsr_genl_family, 0, HSR_C_NODE_DOWN); |
| 266 | if (!msg_head) |
| 267 | goto nla_put_failure; |
| 268 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 269 | res = nla_put(skb, HSR_A_NODE_ADDR, ETH_ALEN, addr); |
| 270 | if (res < 0) |
| 271 | goto nla_put_failure; |
| 272 | |
| 273 | genlmsg_end(skb, msg_head); |
Johannes Berg | 2a94fe4 | 2013-11-19 15:19:39 +0100 | [diff] [blame] | 274 | genlmsg_multicast(&hsr_genl_family, skb, 0, 0, GFP_ATOMIC); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 275 | |
| 276 | return; |
| 277 | |
| 278 | nla_put_failure: |
| 279 | kfree_skb(skb); |
| 280 | |
| 281 | fail: |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 282 | rcu_read_lock(); |
| 283 | master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); |
| 284 | netdev_warn(master->dev, "Could not send HSR node down\n"); |
| 285 | rcu_read_unlock(); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 286 | } |
| 287 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 288 | /* HSR_C_GET_NODE_STATUS lets userspace query the internal HSR node table |
| 289 | * about the status of a specific node in the network, defined by its MAC |
| 290 | * address. |
| 291 | * |
| 292 | * Input: hsr ifindex, node mac address |
| 293 | * Output: hsr ifindex, node mac address (copied from request), |
| 294 | * age of latest frame from node over slave 1, slave 2 [ms] |
| 295 | */ |
| 296 | static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) |
| 297 | { |
| 298 | /* For receiving */ |
| 299 | struct nlattr *na; |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 300 | struct net_device *hsr_dev; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 301 | |
| 302 | /* For sending */ |
| 303 | struct sk_buff *skb_out; |
| 304 | void *msg_head; |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 305 | struct hsr_priv *hsr; |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 306 | struct hsr_port *port; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 307 | unsigned char hsr_node_addr_b[ETH_ALEN]; |
| 308 | int hsr_node_if1_age; |
| 309 | u16 hsr_node_if1_seq; |
| 310 | int hsr_node_if2_age; |
| 311 | u16 hsr_node_if2_seq; |
| 312 | int addr_b_ifindex; |
| 313 | int res; |
| 314 | |
| 315 | if (!info) |
| 316 | goto invalid; |
| 317 | |
| 318 | na = info->attrs[HSR_A_IFINDEX]; |
| 319 | if (!na) |
| 320 | goto invalid; |
| 321 | na = info->attrs[HSR_A_NODE_ADDR]; |
| 322 | if (!na) |
| 323 | goto invalid; |
| 324 | |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 325 | rcu_read_lock(); |
| 326 | hsr_dev = dev_get_by_index_rcu(genl_info_net(info), |
| 327 | nla_get_u32(info->attrs[HSR_A_IFINDEX])); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 328 | if (!hsr_dev) |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 329 | goto rcu_unlock; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 330 | if (!is_hsr_master(hsr_dev)) |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 331 | goto rcu_unlock; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 332 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 333 | /* Send reply */ |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 334 | skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 335 | if (!skb_out) { |
| 336 | res = -ENOMEM; |
| 337 | goto fail; |
| 338 | } |
| 339 | |
| 340 | msg_head = genlmsg_put(skb_out, NETLINK_CB(skb_in).portid, |
Murali Karicheri | 4fe25bd | 2019-04-05 13:31:26 -0400 | [diff] [blame] | 341 | info->snd_seq, &hsr_genl_family, 0, |
| 342 | HSR_C_SET_NODE_STATUS); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 343 | if (!msg_head) { |
| 344 | res = -ENOMEM; |
| 345 | goto nla_put_failure; |
| 346 | } |
| 347 | |
| 348 | res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex); |
| 349 | if (res < 0) |
| 350 | goto nla_put_failure; |
| 351 | |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 352 | hsr = netdev_priv(hsr_dev); |
| 353 | res = hsr_get_node_data(hsr, |
Murali Karicheri | d595b85 | 2019-04-05 13:31:23 -0400 | [diff] [blame] | 354 | (unsigned char *) |
| 355 | nla_data(info->attrs[HSR_A_NODE_ADDR]), |
| 356 | hsr_node_addr_b, |
| 357 | &addr_b_ifindex, |
| 358 | &hsr_node_if1_age, |
| 359 | &hsr_node_if1_seq, |
| 360 | &hsr_node_if2_age, |
| 361 | &hsr_node_if2_seq); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 362 | if (res < 0) |
Geyslan G. Bem | 84a035f | 2013-11-14 16:12:54 -0300 | [diff] [blame] | 363 | goto nla_put_failure; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 364 | |
| 365 | res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, |
Murali Karicheri | 4fe25bd | 2019-04-05 13:31:26 -0400 | [diff] [blame] | 366 | nla_data(info->attrs[HSR_A_NODE_ADDR])); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 367 | if (res < 0) |
| 368 | goto nla_put_failure; |
| 369 | |
| 370 | if (addr_b_ifindex > -1) { |
| 371 | res = nla_put(skb_out, HSR_A_NODE_ADDR_B, ETH_ALEN, |
Murali Karicheri | d595b85 | 2019-04-05 13:31:23 -0400 | [diff] [blame] | 372 | hsr_node_addr_b); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 373 | if (res < 0) |
| 374 | goto nla_put_failure; |
| 375 | |
Murali Karicheri | d595b85 | 2019-04-05 13:31:23 -0400 | [diff] [blame] | 376 | res = nla_put_u32(skb_out, HSR_A_ADDR_B_IFINDEX, |
| 377 | addr_b_ifindex); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 378 | if (res < 0) |
| 379 | goto nla_put_failure; |
| 380 | } |
| 381 | |
| 382 | res = nla_put_u32(skb_out, HSR_A_IF1_AGE, hsr_node_if1_age); |
| 383 | if (res < 0) |
| 384 | goto nla_put_failure; |
| 385 | res = nla_put_u16(skb_out, HSR_A_IF1_SEQ, hsr_node_if1_seq); |
| 386 | if (res < 0) |
| 387 | goto nla_put_failure; |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 388 | port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_A); |
| 389 | if (port) |
| 390 | res = nla_put_u32(skb_out, HSR_A_IF1_IFINDEX, |
| 391 | port->dev->ifindex); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 392 | if (res < 0) |
| 393 | goto nla_put_failure; |
| 394 | |
| 395 | res = nla_put_u32(skb_out, HSR_A_IF2_AGE, hsr_node_if2_age); |
| 396 | if (res < 0) |
| 397 | goto nla_put_failure; |
| 398 | res = nla_put_u16(skb_out, HSR_A_IF2_SEQ, hsr_node_if2_seq); |
| 399 | if (res < 0) |
| 400 | goto nla_put_failure; |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 401 | port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B); |
| 402 | if (port) |
| 403 | res = nla_put_u32(skb_out, HSR_A_IF2_IFINDEX, |
| 404 | port->dev->ifindex); |
Arvid Brodin | 51f3c60 | 2014-07-04 23:37:27 +0200 | [diff] [blame] | 405 | if (res < 0) |
| 406 | goto nla_put_failure; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 407 | |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 408 | rcu_read_unlock(); |
| 409 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 410 | genlmsg_end(skb_out, msg_head); |
| 411 | genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid); |
| 412 | |
| 413 | return 0; |
| 414 | |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 415 | rcu_unlock: |
| 416 | rcu_read_unlock(); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 417 | invalid: |
Johannes Berg | 2d4bc93 | 2017-04-12 14:34:04 +0200 | [diff] [blame] | 418 | netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 419 | return 0; |
| 420 | |
| 421 | nla_put_failure: |
| 422 | kfree_skb(skb_out); |
| 423 | /* Fall through */ |
| 424 | |
| 425 | fail: |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 426 | rcu_read_unlock(); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 427 | return res; |
| 428 | } |
| 429 | |
Arvid Brodin | f266a68 | 2014-07-04 23:41:03 +0200 | [diff] [blame] | 430 | /* Get a list of MacAddressA of all nodes known to this node (including self). |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 431 | */ |
| 432 | static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) |
| 433 | { |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 434 | unsigned char addr[ETH_ALEN]; |
Taehee Yoo | ca19c70 | 2020-03-13 06:50:24 +0000 | [diff] [blame] | 435 | struct net_device *hsr_dev; |
| 436 | struct sk_buff *skb_out; |
| 437 | struct hsr_priv *hsr; |
| 438 | bool restart = false; |
| 439 | struct nlattr *na; |
| 440 | void *pos = NULL; |
| 441 | void *msg_head; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 442 | int res; |
| 443 | |
| 444 | if (!info) |
| 445 | goto invalid; |
| 446 | |
| 447 | na = info->attrs[HSR_A_IFINDEX]; |
| 448 | if (!na) |
| 449 | goto invalid; |
| 450 | |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 451 | rcu_read_lock(); |
| 452 | hsr_dev = dev_get_by_index_rcu(genl_info_net(info), |
| 453 | nla_get_u32(info->attrs[HSR_A_IFINDEX])); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 454 | if (!hsr_dev) |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 455 | goto rcu_unlock; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 456 | if (!is_hsr_master(hsr_dev)) |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 457 | goto rcu_unlock; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 458 | |
Taehee Yoo | ca19c70 | 2020-03-13 06:50:24 +0000 | [diff] [blame] | 459 | restart: |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 460 | /* Send reply */ |
Taehee Yoo | ca19c70 | 2020-03-13 06:50:24 +0000 | [diff] [blame] | 461 | skb_out = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_ATOMIC); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 462 | if (!skb_out) { |
| 463 | res = -ENOMEM; |
| 464 | goto fail; |
| 465 | } |
| 466 | |
| 467 | msg_head = genlmsg_put(skb_out, NETLINK_CB(skb_in).portid, |
Murali Karicheri | 4fe25bd | 2019-04-05 13:31:26 -0400 | [diff] [blame] | 468 | info->snd_seq, &hsr_genl_family, 0, |
| 469 | HSR_C_SET_NODE_LIST); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 470 | if (!msg_head) { |
| 471 | res = -ENOMEM; |
| 472 | goto nla_put_failure; |
| 473 | } |
| 474 | |
Taehee Yoo | ca19c70 | 2020-03-13 06:50:24 +0000 | [diff] [blame] | 475 | if (!restart) { |
| 476 | res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex); |
| 477 | if (res < 0) |
| 478 | goto nla_put_failure; |
| 479 | } |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 480 | |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 481 | hsr = netdev_priv(hsr_dev); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 482 | |
Taehee Yoo | ca19c70 | 2020-03-13 06:50:24 +0000 | [diff] [blame] | 483 | if (!pos) |
| 484 | pos = hsr_get_next_node(hsr, NULL, addr); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 485 | while (pos) { |
| 486 | res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, addr); |
| 487 | if (res < 0) { |
Taehee Yoo | ca19c70 | 2020-03-13 06:50:24 +0000 | [diff] [blame] | 488 | if (res == -EMSGSIZE) { |
| 489 | genlmsg_end(skb_out, msg_head); |
| 490 | genlmsg_unicast(genl_info_net(info), skb_out, |
| 491 | info->snd_portid); |
| 492 | restart = true; |
| 493 | goto restart; |
| 494 | } |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 495 | goto nla_put_failure; |
| 496 | } |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 497 | pos = hsr_get_next_node(hsr, pos, addr); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 498 | } |
| 499 | rcu_read_unlock(); |
| 500 | |
| 501 | genlmsg_end(skb_out, msg_head); |
| 502 | genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid); |
| 503 | |
| 504 | return 0; |
| 505 | |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 506 | rcu_unlock: |
| 507 | rcu_read_unlock(); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 508 | invalid: |
Johannes Berg | 2d4bc93 | 2017-04-12 14:34:04 +0200 | [diff] [blame] | 509 | netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 510 | return 0; |
| 511 | |
| 512 | nla_put_failure: |
Taehee Yoo | ca19c70 | 2020-03-13 06:50:24 +0000 | [diff] [blame] | 513 | nlmsg_free(skb_out); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 514 | /* Fall through */ |
| 515 | |
| 516 | fail: |
Taehee Yoo | 173756b | 2020-03-13 06:50:14 +0000 | [diff] [blame] | 517 | rcu_read_unlock(); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 518 | return res; |
| 519 | } |
| 520 | |
Jakub Kicinski | 66a9b92 | 2020-10-02 14:49:54 -0700 | [diff] [blame] | 521 | static const struct genl_small_ops hsr_ops[] = { |
Johannes Berg | 9504b3e | 2013-11-14 17:14:40 +0100 | [diff] [blame] | 522 | { |
| 523 | .cmd = HSR_C_GET_NODE_STATUS, |
Johannes Berg | ef6243a | 2019-04-26 14:07:31 +0200 | [diff] [blame] | 524 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
Johannes Berg | 9504b3e | 2013-11-14 17:14:40 +0100 | [diff] [blame] | 525 | .flags = 0, |
Johannes Berg | 9504b3e | 2013-11-14 17:14:40 +0100 | [diff] [blame] | 526 | .doit = hsr_get_node_status, |
| 527 | .dumpit = NULL, |
| 528 | }, |
| 529 | { |
| 530 | .cmd = HSR_C_GET_NODE_LIST, |
Johannes Berg | ef6243a | 2019-04-26 14:07:31 +0200 | [diff] [blame] | 531 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
Johannes Berg | 9504b3e | 2013-11-14 17:14:40 +0100 | [diff] [blame] | 532 | .flags = 0, |
Johannes Berg | 9504b3e | 2013-11-14 17:14:40 +0100 | [diff] [blame] | 533 | .doit = hsr_get_node_list, |
| 534 | .dumpit = NULL, |
| 535 | }, |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 536 | }; |
| 537 | |
Johannes Berg | 56989f6 | 2016-10-24 14:40:05 +0200 | [diff] [blame] | 538 | static struct genl_family hsr_genl_family __ro_after_init = { |
Johannes Berg | 489111e | 2016-10-24 14:40:03 +0200 | [diff] [blame] | 539 | .hdrsize = 0, |
| 540 | .name = "HSR", |
| 541 | .version = 1, |
| 542 | .maxattr = HSR_A_MAX, |
Johannes Berg | 3b0f31f | 2019-03-21 22:51:02 +0100 | [diff] [blame] | 543 | .policy = hsr_genl_policy, |
Taehee Yoo | 09e91db | 2020-03-13 06:50:33 +0000 | [diff] [blame] | 544 | .netnsok = true, |
Johannes Berg | 489111e | 2016-10-24 14:40:03 +0200 | [diff] [blame] | 545 | .module = THIS_MODULE, |
Jakub Kicinski | 66a9b92 | 2020-10-02 14:49:54 -0700 | [diff] [blame] | 546 | .small_ops = hsr_ops, |
| 547 | .n_small_ops = ARRAY_SIZE(hsr_ops), |
Jakub Kicinski | 9c5d03d | 2022-08-24 17:18:30 -0700 | [diff] [blame] | 548 | .resv_start_op = HSR_C_SET_NODE_LIST + 1, |
Johannes Berg | 489111e | 2016-10-24 14:40:03 +0200 | [diff] [blame] | 549 | .mcgrps = hsr_mcgrps, |
| 550 | .n_mcgrps = ARRAY_SIZE(hsr_mcgrps), |
| 551 | }; |
| 552 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 553 | int __init hsr_netlink_init(void) |
| 554 | { |
| 555 | int rc; |
| 556 | |
| 557 | rc = rtnl_link_register(&hsr_link_ops); |
| 558 | if (rc) |
| 559 | goto fail_rtnl_link_register; |
| 560 | |
Johannes Berg | 489111e | 2016-10-24 14:40:03 +0200 | [diff] [blame] | 561 | rc = genl_register_family(&hsr_genl_family); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 562 | if (rc) |
| 563 | goto fail_genl_register_family; |
| 564 | |
Taehee Yoo | c6c4ccd | 2019-12-22 11:26:27 +0000 | [diff] [blame] | 565 | hsr_debugfs_create_root(); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 566 | return 0; |
| 567 | |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 568 | fail_genl_register_family: |
| 569 | rtnl_link_unregister(&hsr_link_ops); |
| 570 | fail_rtnl_link_register: |
| 571 | |
| 572 | return rc; |
| 573 | } |
| 574 | |
| 575 | void __exit hsr_netlink_exit(void) |
| 576 | { |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 577 | genl_unregister_family(&hsr_genl_family); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 578 | rtnl_link_unregister(&hsr_link_ops); |
| 579 | } |
| 580 | |
| 581 | MODULE_ALIAS_RTNL_LINK("hsr"); |