1
1

Properly handle case where user instructs the oob to not use all non-localhost

interfaces

This commit was SVN r14815.
Этот коммит содержится в:
Brian Barrett 2007-05-31 02:29:44 +00:00
родитель 07f51ae5dc
Коммит e4b369c93e
3 изменённых файлов: 35 добавлений и 4 удалений

Просмотреть файл

@ -341,6 +341,9 @@ int mca_oob_tcp_component_open(void)
mca_oob_tcp_component.tcp_last_copy_time = 0;
/* updated with real value during tcp_init */
mca_oob_tcp_component.tcp_ignore_localhost = true;
return ORTE_SUCCESS;
}
@ -951,12 +954,37 @@ static void mca_oob_tcp_recv_handler(int sd, short flags, void* user)
*/
mca_oob_t* mca_oob_tcp_component_init(int* priority)
{
int i;
*priority = 1;
/* are there any interfaces? */
if(opal_ifcount() <= 0)
return NULL;
/* see if we should use localhost as an address. We should do so
if after looking at all available interfaces (based on what we
find and what the user restricts with MCA parameters) there are
only local addresses available. */
mca_oob_tcp_component.tcp_ignore_localhost = false;
for (i = opal_ifbegin() ; i > 0 ; i = opal_ifnext(i)) {
char name[32];
struct sockaddr_storage inaddr;
opal_ifindextoname(i, name, sizeof(name));
if (mca_oob_tcp_component.tcp_include != NULL &&
strstr(mca_oob_tcp_component.tcp_include,name) == NULL) {
continue;
}
if (mca_oob_tcp_component.tcp_exclude != NULL &&
strstr(mca_oob_tcp_component.tcp_exclude,name) != NULL) {
continue;
}
opal_ifindextoaddr(i, (struct sockaddr*) &inaddr, sizeof(inaddr));
if(!opal_net_islocalhost((struct sockaddr*) &inaddr)) {
mca_oob_tcp_component.tcp_ignore_localhost = true;
}
}
/* initialize data structures */
opal_hash_table_init(&mca_oob_tcp_component.tcp_peers, 128);
opal_hash_table_init(&mca_oob_tcp_component.tcp_peer_names, 128);
@ -1532,7 +1560,7 @@ char* mca_oob_tcp_get_addr(void)
continue;
}
opal_ifindextoaddr(i, (struct sockaddr*) &addr, sizeof(addr));
if(opal_ifcount() > 1 &&
if(mca_oob_tcp_component.tcp_ignore_localhost &&
opal_net_islocalhost((struct sockaddr*) &addr)) {
continue;
}

Просмотреть файл

@ -325,6 +325,8 @@ struct mca_oob_tcp_component_t {
int tcp_copy_max_size;
int tcp_copy_spin_count;
int connect_sleep;
bool tcp_ignore_localhost; /**< should use localhost as an address or not */
};
/**

Просмотреть файл

@ -78,7 +78,7 @@ int mca_oob_tcp_addr_pack(orte_buffer_t* buffer)
for(i=opal_ifbegin(); i>0; i=opal_ifnext(i)) {
struct sockaddr_storage inaddr;
opal_ifindextoaddr(i, (struct sockaddr*) &inaddr, sizeof(inaddr));
if(opal_ifcount() > 1 &&
if(mca_oob_tcp_component.tcp_ignore_localhost &&
opal_net_islocalhost((struct sockaddr*) &inaddr)) {
continue;
}
@ -95,7 +95,7 @@ int mca_oob_tcp_addr_pack(orte_buffer_t* buffer)
uint16_t port;
opal_ifindextoaddr(i, (struct sockaddr*) &inaddr, sizeof(inaddr));
if(opal_ifcount() > 1 &&
if(mca_oob_tcp_component.tcp_ignore_localhost &&
opal_net_islocalhost((struct sockaddr*) &inaddr))
continue;
@ -252,7 +252,8 @@ int mca_oob_tcp_addr_get_next(mca_oob_tcp_addr_t* addr, struct sockaddr_storage*
continue;
}
opal_ifindextoaddr(ifindex, (struct sockaddr*) &inaddr, sizeof(inaddr));
if(opal_ifcount() > 1 && opal_net_islocalhost((struct sockaddr*) &inaddr)) {
if(mca_oob_tcp_component.tcp_ignore_localhost &&
opal_net_islocalhost((struct sockaddr*) &inaddr)) {
continue;
}
opal_ifindextomask(ifindex, &inmask, sizeof(inmask));