Skip to content

Commit a737d0f

Browse files
author
Ralph Castain
authored
Merge pull request #3430 from bosilca/topic/tcp_hostname
Use the OPAL function to get the hostname.
2 parents 3b99149 + 2d8943d commit a737d0f

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

opal/mca/btl/tcp/btl_tcp_proc.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2014 The University of Tennessee and The University
6+
* Copyright (c) 2004-2017 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -828,20 +828,13 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
828828
/* No further use of this socket. Close it */
829829
CLOSE_THE_SOCKET(sd);
830830
{
831-
char *addr_str=NULL, *tmp, pnet[1024];
831+
char *addr_str = NULL, *tmp, *pnet;
832832
for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) {
833833
mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i];
834834
if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) {
835835
continue;
836836
}
837-
if (AF_INET == addr->sa_family) {
838-
inet_ntop(AF_INET, (void*)(struct in_addr*)&btl_endpoint->endpoint_addr->addr_inet, pnet, 1024);
839-
} else if (AF_INET6 == addr->sa_family) {
840-
inet_ntop(AF_INET6, (void*)(struct in6_addr*)&btl_endpoint->endpoint_addr->addr_inet, pnet, 1024);
841-
} else {
842-
/* unrecognized family */
843-
continue;
844-
}
837+
pnet = opal_net_get_hostname((struct sockaddr*)&btl_endpoint->endpoint_addr->addr_inet);
845838
if (NULL == addr_str) {
846839
(void)asprintf(&tmp, "\n\t%s", pnet);
847840
} else {

0 commit comments

Comments
 (0)