|  | 
| 11 | 11 |  * Copyright (c) 2004-2005 The Regents of the University of California. | 
| 12 | 12 |  *                         All rights reserved. | 
| 13 | 13 |  * Copyright (c) 2008-2010 Oracle and/or its affiliates.  All rights reserved | 
| 14 |  | - * Copyright (c) 2013-2015 Intel, Inc. All rights reserved | 
|  | 14 | + * Copyright (c) 2013-2017 Intel, Inc.  All rights reserved. | 
| 15 | 15 |  * Copyright (c) 2014-2016 Research Organization for Information Science | 
| 16 | 16 |  *                         and Technology (RIST). All rights reserved. | 
| 17 | 17 |  * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights | 
| @@ -828,33 +828,38 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr | 
| 828 | 828 |     /* No further use of this socket. Close it */ | 
| 829 | 829 |     CLOSE_THE_SOCKET(sd); | 
| 830 | 830 |     { | 
| 831 |  | -        size_t len = 1024; | 
| 832 |  | -        char* addr_str = (char*)malloc(len); | 
| 833 |  | -        if( NULL != addr_str ) { | 
| 834 |  | -            memset(addr_str, 0, len); | 
| 835 |  | -            for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) { | 
| 836 |  | -                mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i]; | 
| 837 |  | -                if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) { | 
| 838 |  | -                    continue; | 
| 839 |  | -                } | 
| 840 |  | - | 
| 841 |  | -                if (addr_str[0] != '\0') { | 
| 842 |  | -                    strncat(addr_str, ", ", len); | 
| 843 |  | -                    len -= 2; | 
| 844 |  | -                } | 
| 845 |  | -                strncat(addr_str, inet_ntop(AF_INET6, (void*)(struct in6_addr*)&btl_endpoint->endpoint_addr->addr_inet, | 
| 846 |  | -                                            addr_str + 1024 - len, INET6_ADDRSTRLEN), len); | 
| 847 |  | -                len = 1024 - strlen(addr_str); | 
|  | 831 | +        char *addr_str=NULL, *tmp, pnet[1024]; | 
|  | 832 | +        for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) { | 
|  | 833 | +            mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i]; | 
|  | 834 | +            if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) { | 
|  | 835 | +                continue; | 
| 848 | 836 |             } | 
|  | 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 | +            } | 
|  | 845 | +            if (NULL == addr_str) { | 
|  | 846 | +                (void)asprintf(&tmp, "\n\t%s", pnet); | 
|  | 847 | +            } else { | 
|  | 848 | +                (void)asprintf(&tmp, "%s\n\t%s", addr_str, pnet); | 
|  | 849 | +                free(addr_str); | 
|  | 850 | +            } | 
|  | 851 | +            addr_str = tmp; | 
| 849 | 852 |         } | 
| 850 | 853 |         opal_show_help("help-mpi-btl-tcp.txt", "dropped inbound connection", | 
| 851 | 854 |                        true, opal_process_info.nodename, | 
| 852 | 855 |                        getpid(), | 
| 853 | 856 |                        btl_proc->proc_opal->proc_hostname, | 
| 854 | 857 |                        OPAL_NAME_PRINT(btl_proc->proc_opal->proc_name), | 
| 855 | 858 |                        opal_net_get_hostname((struct sockaddr*)addr), | 
| 856 |  | -                       addr_str); | 
| 857 |  | -        free(addr_str); | 
|  | 859 | +                       (NULL == addr_str) ? "NONE" : addr_str); | 
|  | 860 | +        if (NULL != addr_str) { | 
|  | 861 | +            free(addr_str); | 
|  | 862 | +        } | 
| 858 | 863 |     } | 
| 859 | 864 |     OPAL_THREAD_UNLOCK(&btl_proc->proc_lock); | 
| 860 | 865 | } | 
|  | 
0 commit comments