diff --git a/src/mca/oob/tcp/oob_tcp.c b/src/mca/oob/tcp/oob_tcp.c index 63b7c4abaf..021eae763f 100644 --- a/src/mca/oob/tcp/oob_tcp.c +++ b/src/mca/oob/tcp/oob_tcp.c @@ -382,6 +382,10 @@ mca_oob_t* mca_oob_tcp_component_init(int* priority, bool *allow_multi_user_thre *allow_multi_user_threads = true; *have_hidden_threads = OMPI_HAVE_THREADS; + /* are there any interfaces? */ + if(ompi_ifcount() == 0) + return NULL; + /* initialize data structures */ ompi_rb_tree_init(&mca_oob_tcp_component.tcp_peer_tree, (ompi_rb_tree_comp_fn_t)mca_oob_tcp_process_name_compare); ompi_rb_tree_init(&mca_oob_tcp_component.tcp_peer_names, (ompi_rb_tree_comp_fn_t)mca_oob_tcp_process_name_compare); @@ -704,7 +708,7 @@ char* mca_oob_tcp_get_addr(void) for(i=ompi_ifbegin(); i>0; i=ompi_ifnext(i)) { struct sockaddr_in addr; ompi_ifindextoaddr(i, (struct sockaddr*)&addr, sizeof(addr)); - if(addr.sin_addr.s_addr == inet_addr("127.0.0.1")) + if(ompi_ifcount() > 1 && addr.sin_addr.s_addr == inet_addr("127.0.0.1")) continue; if(ptr != contact_info) { ptr += sprintf(ptr, ";"); diff --git a/src/mca/oob/tcp/oob_tcp_addr.c b/src/mca/oob/tcp/oob_tcp_addr.c index b15286dd83..aedce74e4d 100644 --- a/src/mca/oob/tcp/oob_tcp_addr.c +++ b/src/mca/oob/tcp/oob_tcp_addr.c @@ -38,19 +38,20 @@ void mca_oob_tcp_addr_pack(ompi_buffer_t buffer) int i; ompi_pack(buffer, &mca_oob_name_self, 1, OMPI_NAME); + for(i=ompi_ifbegin(); i>0; i=ompi_ifnext(i)) { struct sockaddr_in inaddr; ompi_ifindextoaddr(i, (struct sockaddr*)&inaddr, sizeof(inaddr)); - if(inaddr.sin_addr.s_addr == inet_addr("127.0.0.1")) + if(ompi_ifcount() > 1 && inaddr.sin_addr.s_addr == inet_addr("127.0.0.1")) continue; count++; - } + } ompi_pack(buffer, &count, 1, OMPI_INT32); for(i=ompi_ifbegin(); i>0; i=ompi_ifnext(i)) { struct sockaddr_in inaddr; ompi_ifindextoaddr(i, (struct sockaddr*)&inaddr, sizeof(inaddr)); - if(inaddr.sin_addr.s_addr == inet_addr("127.0.0.1")) + if(ompi_ifcount() > 1 && inaddr.sin_addr.s_addr == inet_addr("127.0.0.1")) continue; inaddr.sin_port = mca_oob_tcp_component.tcp_listen_port; ompi_pack(buffer,&inaddr,sizeof(inaddr),OMPI_BYTE); diff --git a/src/mca/ptl/tcp/src/ptl_tcp_component.c b/src/mca/ptl/tcp/src/ptl_tcp_component.c index 8dc1c79e19..38020163bc 100644 --- a/src/mca/ptl/tcp/src/ptl_tcp_component.c +++ b/src/mca/ptl/tcp/src/ptl_tcp_component.c @@ -317,14 +317,18 @@ static int mca_ptl_tcp_component_create_instances(void) ompi_ifindextoname(if_index, if_name, sizeof(if_name)); /* check to see if this interface exists in the exclude list */ - argv = exclude; - while(argv && *argv) { - if(strncmp(*argv,if_name,strlen(*argv)) == 0) - break; - argv++; - } - /* if this interface was not found in the excluded list - create a PTL */ - if(argv == 0 || *argv == 0) { + if(ompi_ifcount() > 1) { + argv = exclude; + while(argv && *argv) { + if(strncmp(*argv,if_name,strlen(*argv)) == 0) + break; + argv++; + } + /* if this interface was not found in the excluded list - create a PTL */ + if(argv == 0 || *argv == 0) { + mca_ptl_tcp_create(if_index, if_name); + } + } else { mca_ptl_tcp_create(if_index, if_name); } }