@@ -513,17 +513,12 @@ static int mca_btl_tcp_create(int if_kindex, const char* if_name)
513
513
btl -> tcp_send_handler = 0 ;
514
514
#endif
515
515
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
+
527
522
/* allow user to specify interface bandwidth */
528
523
sprintf (param , "bandwidth_%s" , if_name );
529
524
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)
567
562
opal_output_verbose (5 , opal_btl_base_framework .framework_output ,
568
563
"btl:tcp: %p: if %s kidx %d cnt %i addr %s %s bw %d lt %d\n" ,
569
564
(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" ,
572
567
btl -> super .btl_bandwidth , btl -> super .btl_latency );
573
568
}
574
569
return OPAL_SUCCESS ;
@@ -721,6 +716,7 @@ static int mca_btl_tcp_component_create_instances(void)
721
716
*/
722
717
for (if_index = opal_ifbegin (); if_index >= 0 ; if_index = opal_ifnext (if_index )){
723
718
int index = opal_ifindextokindex (if_index );
719
+
724
720
if (index > 0 ) {
725
721
bool want_this_if = true;
726
722
@@ -1172,7 +1168,7 @@ static int mca_btl_tcp_component_exchange(void)
1172
1168
(6 != mca_btl_tcp_component .tcp_disable_family )) {
1173
1169
memcpy (& addrs [current_addr ].addr_inet ,
1174
1170
& ((struct sockaddr_in6 * )& my_ss )-> sin6_addr ,
1175
- sizeof (addrs [0 ].addr_inet ));
1171
+ sizeof (addrs [0 ].addr_inet ));
1176
1172
addrs [current_addr ].addr_port =
1177
1173
mca_btl_tcp_component .tcp6_listen_port ;
1178
1174
addrs [current_addr ].addr_family = MCA_BTL_TCP_AF_INET6 ;
0 commit comments