@@ -513,17 +513,12 @@ static int mca_btl_tcp_create(int if_kindex, const char* if_name)
513513 btl -> tcp_send_handler = 0 ;
514514#endif
515515
516- struct sockaddr_storage addr ;
517- opal_ifkindextoaddr (if_kindex , (struct sockaddr * ) & addr ,
518- sizeof (struct sockaddr_storage ));
519- #if OPAL_ENABLE_IPV6
520- if (addr .ss_family == AF_INET6 ) {
521- btl -> tcp_ifaddr_6 = addr ;
522- }
523- #endif
524- if (addr .ss_family == AF_INET ) {
525- btl -> tcp_ifaddr = addr ;
526- }
516+ /* save the address associated with this kindex in the module
517+ to publish in the modex and use as the source of all packets
518+ from this module */
519+ opal_ifkindextoaddr (if_kindex , (struct sockaddr * )& btl -> tcp_ifaddr ,
520+ sizeof (struct sockaddr_storage ));
521+
527522 /* allow user to specify interface bandwidth */
528523 sprintf (param , "bandwidth_%s" , if_name );
529524 mca_btl_tcp_param_register_uint (param , NULL , btl -> super .btl_bandwidth , OPAL_INFO_LVL_5 , & btl -> super .btl_bandwidth );
@@ -567,8 +562,8 @@ static int mca_btl_tcp_create(int if_kindex, const char* if_name)
567562 opal_output_verbose (5 , opal_btl_base_framework .framework_output ,
568563 "btl:tcp: %p: if %s kidx %d cnt %i addr %s %s bw %d lt %d\n" ,
569564 (void * )btl , if_name , (int ) btl -> tcp_ifkindex , i ,
570- opal_net_get_hostname ((struct sockaddr * )& addr ),
571- (addr .ss_family == AF_INET ) ? "IPv4" : "IPv6" ,
565+ opal_net_get_hostname ((struct sockaddr * )& btl -> tcp_ifaddr ),
566+ (btl -> tcp_ifaddr .ss_family == AF_INET ) ? "IPv4" : "IPv6" ,
572567 btl -> super .btl_bandwidth , btl -> super .btl_latency );
573568 }
574569 return OPAL_SUCCESS ;
@@ -721,6 +716,7 @@ static int mca_btl_tcp_component_create_instances(void)
721716 */
722717 for (if_index = opal_ifbegin (); if_index >= 0 ; if_index = opal_ifnext (if_index )){
723718 int index = opal_ifindextokindex (if_index );
719+
724720 if (index > 0 ) {
725721 bool want_this_if = true;
726722
@@ -1172,7 +1168,7 @@ static int mca_btl_tcp_component_exchange(void)
11721168 (6 != mca_btl_tcp_component .tcp_disable_family )) {
11731169 memcpy (& addrs [current_addr ].addr_inet ,
11741170 & ((struct sockaddr_in6 * )& my_ss )-> sin6_addr ,
1175- sizeof (addrs [0 ].addr_inet ));
1171+ sizeof (addrs [0 ].addr_inet ));
11761172 addrs [current_addr ].addr_port =
11771173 mca_btl_tcp_component .tcp6_listen_port ;
11781174 addrs [current_addr ].addr_family = MCA_BTL_TCP_AF_INET6 ;
0 commit comments