Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions opal/mca/reachable/netlink/reachable_netlink_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions opal/mca/reachable/reachable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down