@@ -728,34 +728,39 @@ static int mca_btl_tcp_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endpo
728
728
729
729
/* start the connect - will likely fail with EINPROGRESS */
730
730
mca_btl_tcp_proc_tosocks (btl_endpoint -> endpoint_addr , & endpoint_addr );
731
-
731
+
732
732
/* Bind the socket to one of the addresses associated with
733
733
* this btl module. This sets the source IP to one of the
734
734
* addresses shared in modex, so that the destination rank
735
735
* can properly pair btl modules, even in cases where Linux
736
736
* might do something unexpected with routing */
737
- opal_socklen_t sockaddr_addrlen = sizeof (struct sockaddr_storage );
738
737
if (endpoint_addr .ss_family == AF_INET ) {
739
738
assert (NULL != & btl_endpoint -> endpoint_btl -> tcp_ifaddr );
740
739
if (bind (btl_endpoint -> endpoint_sd , (struct sockaddr * ) & btl_endpoint -> endpoint_btl -> tcp_ifaddr ,
741
- sockaddr_addrlen ) < 0 ) {
742
- BTL_ERROR (("bind() failed: %s (%d)" , strerror (opal_socket_errno ), opal_socket_errno ));
740
+ sizeof (struct sockaddr_in )) < 0 ) {
741
+ BTL_ERROR (("bind on local address (%s:%d) failed: %s (%d)" ,
742
+ opal_net_get_hostname ((struct sockaddr * ) & btl_endpoint -> endpoint_btl -> tcp_ifaddr ),
743
+ htons (((struct sockaddr_in * )& btl_endpoint -> endpoint_btl -> tcp_ifaddr )-> sin_port ),
744
+ strerror (opal_socket_errno ), opal_socket_errno ));
743
745
744
- CLOSE_THE_SOCKET (btl_endpoint -> endpoint_sd );
745
- return OPAL_ERROR ;
746
- }
746
+ CLOSE_THE_SOCKET (btl_endpoint -> endpoint_sd );
747
+ return OPAL_ERROR ;
748
+ }
747
749
}
748
750
#if OPAL_ENABLE_IPV6
749
751
if (endpoint_addr .ss_family == AF_INET6 ) {
750
752
assert (NULL != & btl_endpoint -> endpoint_btl -> tcp_ifaddr_6 );
751
753
if (bind (btl_endpoint -> endpoint_sd , (struct sockaddr * ) & btl_endpoint -> endpoint_btl -> tcp_ifaddr_6 ,
752
- sockaddr_addrlen ) < 0 ) {
753
- BTL_ERROR (("bind() failed: %s (%d)" , strerror (opal_socket_errno ), opal_socket_errno ));
754
+ sizeof (struct sockaddr_in6 )) < 0 ) {
755
+ BTL_ERROR (("bind on local address (%s:%d) failed: %s (%d)" ,
756
+ opal_net_get_hostname ((struct sockaddr * ) & btl_endpoint -> endpoint_btl -> tcp_ifaddr ),
757
+ htons (((struct sockaddr_in * )& btl_endpoint -> endpoint_btl -> tcp_ifaddr )-> sin_port ),
758
+ strerror (opal_socket_errno ), opal_socket_errno ));
754
759
755
- CLOSE_THE_SOCKET (btl_endpoint -> endpoint_sd );
756
- return OPAL_ERROR ;
757
- }
758
- }
760
+ CLOSE_THE_SOCKET (btl_endpoint -> endpoint_sd );
761
+ return OPAL_ERROR ;
762
+ }
763
+ }
759
764
#endif
760
765
opal_output_verbose (10 , opal_btl_base_framework .framework_output ,
761
766
"btl: tcp: attempting to connect() to %s address %s on port %d" ,
0 commit comments