Skip to content

Commit 4bc7b21

Browse files
committed
Btl tcp: Improving verbose around IPV6
As part of improvement around tcp btl debugging & verbose. we are improving verbose around IPV6 Signed-off-by: Mohan Gandhi <[email protected]>
1 parent 0741fad commit 4bc7b21

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

opal/mca/btl/tcp/btl_tcp_component.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,13 +858,18 @@ static int mca_btl_tcp_component_create_listen(uint16_t af_family)
858858
freeaddrinfo (res);
859859

860860
#ifdef IPV6_V6ONLY
861-
/* in case of AF_INET6, disable v4-mapped addresses */
861+
/* If this OS supports the "IPV6_V6ONLY" constant, then set it
862+
on this socket. It specifies that *only* V6 connections
863+
should be accepted on this socket (vs. allowing incoming
864+
both V4 and V6 connections -- which is actually defined
865+
behavior for V6<-->V4 interop stuff). See
866+
https://github.com/open-mpi/ompi/commit/95d7e08a6617530d57b6700c57738b351bfccbf8 for some
867+
more details. */
862868
if (AF_INET6 == af_family) {
863869
int flg = 1;
864870
if (setsockopt (sd, IPPROTO_IPV6, IPV6_V6ONLY,
865871
(char *) &flg, sizeof (flg)) < 0) {
866-
opal_output(0,
867-
"mca_btl_tcp_create_listen: unable to disable v4-mapped addresses\n");
872+
BTL_ERROR((0, "mca_btl_tcp_create_listen: unable to set IPV6_V6ONLY\n"));
868873
}
869874
}
870875
#endif /* IPV6_V6ONLY */
@@ -906,6 +911,10 @@ static int mca_btl_tcp_component_create_listen(uint16_t af_family)
906911
#else
907912
((struct sockaddr_in*) &inaddr)->sin_port = htons(port + index);
908913
#endif /* OPAL_ENABLE_IPV6 */
914+
opal_output_verbose(30, opal_btl_base_framework.framework_output,
915+
"btl:tcp: Attempting to bind to %s port %d",
916+
(AF_INET == af_family) ? "AF_INET" : "AF_INET6",
917+
port + index);
909918
if(bind(sd, (struct sockaddr*)&inaddr, addrlen) < 0) {
910919
if( (EADDRINUSE == opal_socket_errno) || (EADDRNOTAVAIL == opal_socket_errno) ) {
911920
continue;
@@ -915,6 +924,10 @@ static int mca_btl_tcp_component_create_listen(uint16_t af_family)
915924
CLOSE_THE_SOCKET(sd);
916925
return OPAL_ERROR;
917926
}
927+
opal_output_verbose(30, opal_btl_base_framework.framework_output,
928+
"btl:tcp: Successfully bound to %s port %d",
929+
(AF_INET == af_family) ? "AF_INET" : "AF_INET6",
930+
port + index);
918931
goto socket_binded;
919932
}
920933
#if OPAL_ENABLE_IPV6
@@ -945,6 +958,9 @@ static int mca_btl_tcp_component_create_listen(uint16_t af_family)
945958
if (AF_INET6 == af_family) {
946959
mca_btl_tcp_component.tcp6_listen_port = ((struct sockaddr_in6*) &inaddr)->sin6_port;
947960
mca_btl_tcp_component.tcp6_listen_sd = sd;
961+
opal_output_verbose(30, opal_btl_base_framework.framework_output,
962+
"btl:tcp: my listening v6 socket port is %d",
963+
ntohs(mca_btl_tcp_component.tcp6_listen_port));
948964
} else
949965
#endif
950966
{
@@ -1143,6 +1159,8 @@ static int mca_btl_tcp_component_exchange(void)
11431159
addrs[current_addr].addr_ifkindex =
11441160
opal_ifindextokindex (index);
11451161
current_addr++;
1162+
opal_output_verbose(30, opal_btl_base_framework.framework_output,
1163+
"btl:tcp: using ipv6 interface %s", ifn);
11461164
}
11471165
} /* end of for opal_ifbegin() */
11481166
} /* end of for tcp_num_btls */

opal/mca/btl/tcp/btl_tcp_proc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ int mca_btl_tcp_proc_insert( mca_btl_tcp_proc_t* btl_proc,
421421
mca_btl_tcp_proc_data_t _proc_data, *proc_data=&_proc_data;
422422
size_t max_peer_interfaces;
423423
memset(proc_data, 0, sizeof(mca_btl_tcp_proc_data_t));
424+
char str_local[128], str_remote[128];
424425

425426
if (NULL == (proc_hostname = opal_get_proc_hostname(btl_proc->proc_opal))) {
426427
return OPAL_ERR_UNREACH;
@@ -582,12 +583,24 @@ int mca_btl_tcp_proc_insert( mca_btl_tcp_proc_t* btl_proc,
582583
if(NULL != local_interface->ipv6_address &&
583584
NULL != peer_interfaces[j]->ipv6_address) {
584585

586+
/* Convert the IPv6 addresses into nicely-printable strings for verbose debugging output */
587+
inet_ntop(AF_INET6, &(((struct sockaddr_in6*) local_interface->ipv6_address))->sin6_addr,
588+
str_local, sizeof(str_local));
589+
inet_ntop(AF_INET6, &(((struct sockaddr_in6*) peer_interfaces[j]->ipv6_address))->sin6_addr,
590+
str_remote, sizeof(str_remote));
591+
585592
if(opal_net_samenetwork((struct sockaddr*) local_interface->ipv6_address,
586593
(struct sockaddr*) peer_interfaces[j]->ipv6_address,
587594
local_interface->ipv6_netmask)) {
588595
proc_data->weights[i][j] = CQ_PUBLIC_SAME_NETWORK;
596+
opal_output_verbose(20, opal_btl_base_framework.framework_output,
597+
"btl:tcp: path from %s to %s: IPV6 PUBLIC SAME NETWORK",
598+
str_local, str_remote);
589599
} else {
590600
proc_data->weights[i][j] = CQ_PUBLIC_DIFFERENT_NETWORK;
601+
opal_output_verbose(20, opal_btl_base_framework.framework_output,
602+
"btl:tcp: path from %s to %s: IPV6 PUBLIC DIFFERENT NETWORK",
603+
str_local, str_remote);
591604
}
592605
proc_data->best_addr[i][j] = peer_interfaces[j]->ipv6_endpoint_addr;
593606
continue;

0 commit comments

Comments
 (0)