diff options
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index e9c52e1416c5..81e6dd0cd1ca 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -195,6 +195,27 @@ int tipc_node_get_mtu(struct net *net, u32 addr, u32 sel) | |||
195 | return mtu; | 195 | return mtu; |
196 | } | 196 | } |
197 | 197 | ||
198 | bool tipc_node_get_id(struct net *net, u32 addr, u8 *id) | ||
199 | { | ||
200 | u8 *own_id = tipc_own_id(net); | ||
201 | struct tipc_node *n; | ||
202 | |||
203 | if (!own_id) | ||
204 | return true; | ||
205 | |||
206 | if (addr == tipc_own_addr(net)) { | ||
207 | memcpy(id, own_id, TIPC_NODEID_LEN); | ||
208 | return true; | ||
209 | } | ||
210 | n = tipc_node_find(net, addr); | ||
211 | if (!n) | ||
212 | return false; | ||
213 | |||
214 | memcpy(id, &n->peer_id, TIPC_NODEID_LEN); | ||
215 | tipc_node_put(n); | ||
216 | return true; | ||
217 | } | ||
218 | |||
198 | u16 tipc_node_get_capabilities(struct net *net, u32 addr) | 219 | u16 tipc_node_get_capabilities(struct net *net, u32 addr) |
199 | { | 220 | { |
200 | struct tipc_node *n; | 221 | struct tipc_node *n; |