diff --git a/opal/mca/reachable/netlink/reachable_netlink_module.c b/opal/mca/reachable/netlink/reachable_netlink_module.c index efb5ee6585b..cf6609242d5 100644 --- a/opal/mca/reachable/netlink/reachable_netlink_module.c +++ b/opal/mca/reachable/netlink/reachable_netlink_module.c @@ -2,8 +2,8 @@ /* * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Cisco Systems. All rights reserved. - * Copyright (c) 2017 Amazon.com, Inc. or its affiliates. - * All Rights reserved. + * Copyright (c) 2017-2019 Amazon.com, Inc. or its affiliates. + * All Rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -112,6 +112,17 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if) remote_ip = (uint32_t)((struct sockaddr_in *)&(remote_if->if_addr))->sin_addr.s_addr; outgoing_interface = local_if->if_kernel_index; + /* If the ips are identical, assume reachable through loopback. This + is done artificially due to historical reasons. With this, we can + maintain similar behavior to previous implementations. */ + if (local_ip == remote_ip) { + conn_type = "IPv4 SAME NETWORK"; + weight = calculate_weight(local_if->if_bandwidth, + remote_if->if_bandwidth, + CQ_SAME_NETWORK); + goto out; + } + ret = opal_reachable_netlink_rt_lookup(local_ip, remote_ip, outgoing_interface, @@ -141,6 +152,18 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if) remote_ip = &((struct sockaddr_in6 *)&(remote_if->if_addr))->sin6_addr; outgoing_interface = local_if->if_kernel_index; + /* If the ips are identical, assume reachable through loopback. This + is done artificially due to historical reasons. With this, we can + maintain similar behavior to previous implementations. */ + if (local_ip == remote_ip) { + conn_type = "IPv6 SAME NETWORK"; + weight = calculate_weight(local_if->if_bandwidth, + remote_if->if_bandwidth, + CQ_SAME_NETWORK); + + goto out; + } + ret = opal_reachable_netlink_rt_lookup6(local_ip, remote_ip, outgoing_interface, @@ -171,6 +194,7 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if) weight = calculate_weight(0, 0, CQ_NO_CONNECTION); } +out: opal_output_verbose(20, opal_reachable_base_framework.framework_output, "reachable:netlink: path from %s to %s: %s", str_local, str_remote, conn_type); diff --git a/opal/mca/reachable/reachable.h b/opal/mca/reachable/reachable.h index 5f6b193829b..9d2f31f706d 100644 --- a/opal/mca/reachable/reachable.h +++ b/opal/mca/reachable/reachable.h @@ -75,6 +75,8 @@ typedef int (*opal_reachable_base_module_fini_fn_t)(void); * interfaces, but only a (comparable) reachability between any pair * of local/remote interfaces. * + * This function will show an identical local and remote interface as + * reachable. * */ typedef opal_reachable_t*