1
1

Enable some debugging in the if discovery code

This commit was SVN r27367.
Этот коммит содержится в:
Ralph Castain 2012-09-25 20:23:37 +00:00
родитель cb65a44c6c
Коммит 01504239e6
3 изменённых файлов: 36 добавлений и 22 удалений

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

@ -27,6 +27,7 @@ OPAL_DECLSPEC int opal_if_base_close(void);
* Globals
*/
OPAL_DECLSPEC extern opal_list_t opal_if_components;
OPAL_DECLSPEC extern int opal_if_base_output;
END_C_DECLS

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

@ -16,7 +16,7 @@
#include "opal/mca/if/base/base.h"
#include "opal/mca/if/base/static-components.h"
int opal_if_base_output;
int opal_if_base_output=-1;
opal_list_t opal_if_components;
static bool already_done = false;
@ -41,6 +41,14 @@ int opal_if_base_open(void)
/* setup the global list */
OBJ_CONSTRUCT(&opal_if_list, opal_list_t);
mca_base_param_reg_int_name("if", "base_verbose",
"Provide verbose output if greater than 0",
false, false, -1, &ret);
if (0 < ret) {
opal_if_base_output = opal_output_open(NULL);
opal_output_set_verbosity(opal_if_base_output, ret);
}
mca_base_param_reg_int_name("opal", "if_do_not_resolve",
"If nonzero, do not attempt to resolve interfaces",
false, false, (int)false, &ret);
@ -62,6 +70,10 @@ int opal_if_base_open(void)
cli->cli_component = mca_if_base_static_components[i];
opal_list_append(&opal_if_components, &cli->super);
opal_output_verbose(5, opal_if_base_output,
"if:base: opening component %s",
component->component.mca_component_name);
if (NULL != component->component.mca_open_component) {
ret = component->component.mca_open_component();
if (OPAL_SUCCESS != ret) continue;

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

@ -62,6 +62,7 @@
#endif
#include "opal/mca/if/if.h"
#include "opal/mca/if/base/base.h"
static int if_bsdx_ipv6_open(void);
@ -104,6 +105,9 @@ static int if_bsdx_ipv6_open(void)
struct ifaddrs *cur_ifaddrs;
struct sockaddr_in6* sin_addr;
opal_output_verbose(1, opal_if_base_output,
"searching for IPv6 interfaces");
/*
* the manpage claims that getifaddrs() allocates the memory,
* and freeifaddrs() is later used to release the allocated memory.
@ -126,17 +130,16 @@ static int if_bsdx_ipv6_open(void)
/* skip non-ipv6 interface addresses */
if (AF_INET6 != cur_ifaddrs->ifa_addr->sa_family) {
#if 0
printf("skipping non-ipv6 interface %s.\n", cur_ifaddrs->ifa_name);
#endif
opal_output_verbose(1, opal_if_base_output,
"skipping non-ipv6 interface %s[%d].\n",
cur_ifaddrs->ifa_name, (int)cur_ifaddrs->ifa_addr->sa_family);
continue;
}
/* skip interface if it is down (IFF_UP not set) */
if (0 == (cur_ifaddrs->ifa_flags & IFF_UP)) {
#if 0
printf("skipping non-up interface %s.\n", cur_ifaddrs->ifa_name);
#endif
opal_output_verbose(1, opal_if_base_output,
"skipping non-up interface %s.\n", cur_ifaddrs->ifa_name);
continue;
}
@ -148,9 +151,8 @@ static int if_bsdx_ipv6_open(void)
/* or if it is a point-to-point interface */
/* TODO: do we really skip p2p? */
if (0!= (cur_ifaddrs->ifa_flags & IFF_POINTOPOINT)) {
#if 0
printf("skipping loopback interface %s.\n", cur_ifaddrs->ifa_name);
#endif
opal_output_verbose(1, opal_if_base_output,
"skipping loopback interface %s.\n", cur_ifaddrs->ifa_name);
continue;
}
@ -175,21 +177,20 @@ static int if_bsdx_ipv6_open(void)
*/
if ((IN6_IS_ADDR_LINKLOCAL (&sin_addr->sin6_addr))) {
#if 0
printf("skipping link-local ipv6 address on interface \
%s with scope %d.\n",
cur_ifaddrs->ifa_name, sin_addr->sin6_scope_id);
#endif
opal_output_verbose(1, opal_if_base_output,
"skipping link-local ipv6 address on interface "
"%s with scope %d.\n",
cur_ifaddrs->ifa_name, sin_addr->sin6_scope_id);
continue;
}
#if 0
char *addr_name = (char *) malloc(48*sizeof(char));
inet_ntop(AF_INET6, &sin_addr->sin6_addr, addr_name, 48*sizeof(char));
opal_output(0, "ipv6 capable interface %s discovered, address %s.\n",
cur_ifaddrs->ifa_name, addr_name);
free(addr_name);
#endif
if (0 < opal_output_get_verbosity(opal_if_base_output)) {
char *addr_name = (char *) malloc(48*sizeof(char));
inet_ntop(AF_INET6, &sin_addr->sin6_addr, addr_name, 48*sizeof(char));
opal_output(0, "ipv6 capable interface %s discovered, address %s.\n",
cur_ifaddrs->ifa_name, addr_name);
free(addr_name);
}
/* fill values into the opal_if_t */
memcpy(&a6, &(sin_addr->sin6_addr), sizeof(struct in6_addr));