diff options
author | Hoang Le <hoang.h.le@dektech.com.au> | 2020-12-03 10:50:45 +0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-12-04 17:40:27 -0800 |
commit | 43fcd906d9c1048f2492a412917e70ce91775dfb (patch) | |
tree | 2421c157a6cfdebd31252b42afd5f12b6bbf7230 /net/tipc | |
parent | 7f356166aebb0d956d367dfe55e19d7783277d09 (diff) | |
download | linux-43fcd906d9c1048f2492a412917e70ce91775dfb.tar.bz2 |
tipc: support 128bit node identity for peer removing
We add the support to remove a specific node down with 128bit
node identifier, as an alternative to legacy 32-bit node address.
example:
$tipc peer remove identiy <1001002|16777777>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Link: https://lore.kernel.org/r/20201203035045.4564-1-hoang.h.le@dektech.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/node.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index c4b87d2cc0e3..86b4d7ffb47a 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -2222,6 +2222,9 @@ int tipc_nl_peer_rm(struct sk_buff *skb, struct genl_info *info) struct tipc_net *tn = net_generic(net, tipc_net_id); struct nlattr *attrs[TIPC_NLA_NET_MAX + 1]; struct tipc_node *peer, *temp_node; + u8 node_id[NODE_ID_LEN]; + u64 *w0 = (u64 *)&node_id[0]; + u64 *w1 = (u64 *)&node_id[8]; u32 addr; int err; @@ -2235,10 +2238,22 @@ int tipc_nl_peer_rm(struct sk_buff *skb, struct genl_info *info) if (err) return err; - if (!attrs[TIPC_NLA_NET_ADDR]) - return -EINVAL; + /* attrs[TIPC_NLA_NET_NODEID] and attrs[TIPC_NLA_NET_ADDR] are + * mutually exclusive cases + */ + if (attrs[TIPC_NLA_NET_ADDR]) { + addr = nla_get_u32(attrs[TIPC_NLA_NET_ADDR]); + if (!addr) + return -EINVAL; + } - addr = nla_get_u32(attrs[TIPC_NLA_NET_ADDR]); + if (attrs[TIPC_NLA_NET_NODEID]) { + if (!attrs[TIPC_NLA_NET_NODEID_W1]) + return -EINVAL; + *w0 = nla_get_u64(attrs[TIPC_NLA_NET_NODEID]); + *w1 = nla_get_u64(attrs[TIPC_NLA_NET_NODEID_W1]); + addr = hash128to32(node_id); + } if (in_own_node(net, addr)) return -ENOTSUPP; |