tipc: introduce ioctl for fetching node identity
After the introduction of a 128-bit node identity it may be difficult for a user to correlate between this identity and the generated node hash address. We now try to make this easier by introducing a new ioctl() call for fetching a node identity by using the hash value as key. This will be particularly useful when we extend some of the commands in the 'tipc' tool, but we also expect regular user applications to need this feature. Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
79741a38b4
commit
3e5cf362c3
@@ -195,6 +195,27 @@ int tipc_node_get_mtu(struct net *net, u32 addr, u32 sel)
|
||||
return mtu;
|
||||
}
|
||||
|
||||
bool tipc_node_get_id(struct net *net, u32 addr, u8 *id)
|
||||
{
|
||||
u8 *own_id = tipc_own_id(net);
|
||||
struct tipc_node *n;
|
||||
|
||||
if (!own_id)
|
||||
return true;
|
||||
|
||||
if (addr == tipc_own_addr(net)) {
|
||||
memcpy(id, own_id, TIPC_NODEID_LEN);
|
||||
return true;
|
||||
}
|
||||
n = tipc_node_find(net, addr);
|
||||
if (!n)
|
||||
return false;
|
||||
|
||||
memcpy(id, &n->peer_id, TIPC_NODEID_LEN);
|
||||
tipc_node_put(n);
|
||||
return true;
|
||||
}
|
||||
|
||||
u16 tipc_node_get_capabilities(struct net *net, u32 addr)
|
||||
{
|
||||
struct tipc_node *n;
|
||||
|
Reference in New Issue
Block a user