Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions opal/mca/btl/tcp/btl_tcp_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2010 Oracle and/or its affiliates. All rights reserved
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights
Expand Down Expand Up @@ -828,33 +828,38 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
/* No further use of this socket. Close it */
CLOSE_THE_SOCKET(sd);
{
size_t len = 1024;
char* addr_str = (char*)malloc(len);
if( NULL != addr_str ) {
memset(addr_str, 0, len);
for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) {
mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i];
if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) {
continue;
}

if (addr_str[0] != '\0') {
strncat(addr_str, ", ", len);
len -= 2;
}
strncat(addr_str, inet_ntop(AF_INET6, (void*)(struct in6_addr*)&btl_endpoint->endpoint_addr->addr_inet,
addr_str + 1024 - len, INET6_ADDRSTRLEN), len);
len = 1024 - strlen(addr_str);
char *addr_str=NULL, *tmp, pnet[1024];
for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) {
mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i];
if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) {
continue;
}
if (AF_INET == addr->sa_family) {
inet_ntop(AF_INET, (void*)(struct in_addr*)&btl_endpoint->endpoint_addr->addr_inet, pnet, 1024);
} else if (AF_INET6 == addr->sa_family) {
inet_ntop(AF_INET6, (void*)(struct in6_addr*)&btl_endpoint->endpoint_addr->addr_inet, pnet, 1024);
} else {
/* unrecognized family */
continue;
}
if (NULL == addr_str) {
(void)asprintf(&tmp, "\n\t%s", pnet);
} else {
(void)asprintf(&tmp, "%s\n\t%s", addr_str, pnet);
free(addr_str);
}
addr_str = tmp;
}
opal_show_help("help-mpi-btl-tcp.txt", "dropped inbound connection",
true, opal_process_info.nodename,
getpid(),
btl_proc->proc_opal->proc_hostname,
OPAL_NAME_PRINT(btl_proc->proc_opal->proc_name),
opal_net_get_hostname((struct sockaddr*)addr),
addr_str);
free(addr_str);
(NULL == addr_str) ? "NONE" : addr_str);
if (NULL != addr_str) {
free(addr_str);
}
}
OPAL_THREAD_UNLOCK(&btl_proc->proc_lock);
}
Expand Down