diff options
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 3b86a74cb31f..1f938f3dba4b 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -438,3 +438,30 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
438 | rcu_read_unlock(); | 438 | rcu_read_unlock(); |
439 | return buf; | 439 | return buf; |
440 | } | 440 | } |
441 | |||
442 | /** | ||
443 | * tipc_node_get_linkname - get the name of a link | ||
444 | * | ||
445 | * @bearer_id: id of the bearer | ||
446 | * @node: peer node address | ||
447 | * @linkname: link name output buffer | ||
448 | * | ||
449 | * Returns 0 on success | ||
450 | */ | ||
451 | int tipc_node_get_linkname(u32 bearer_id, u32 addr, char *linkname, size_t len) | ||
452 | { | ||
453 | struct tipc_link *link; | ||
454 | struct tipc_node *node = tipc_node_find(addr); | ||
455 | |||
456 | if ((bearer_id > MAX_BEARERS) || !node) | ||
457 | return -EINVAL; | ||
458 | tipc_node_lock(node); | ||
459 | link = node->links[bearer_id]; | ||
460 | if (link) { | ||
461 | strncpy(linkname, link->name, len); | ||
462 | tipc_node_unlock(node); | ||
463 | return 0; | ||
464 | } | ||
465 | tipc_node_unlock(node); | ||
466 | return -EINVAL; | ||
467 | } | ||