Skip to content

Commit d768d82

Browse files
authored
Merge pull request #7167 from wckzhang/reachable_netlinks
Reachable documentation change
2 parents fc8c7a5 + a471f87 commit d768d82

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

opal/mca/reachable/netlink/reachable_netlink_module.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/*
33
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
44
* Copyright (c) 2015 Cisco Systems. All rights reserved.
5-
* Copyright (c) 2017 Amazon.com, Inc. or its affiliates.
6-
* All Rights reserved.
5+
* Copyright (c) 2017-2019 Amazon.com, Inc. or its affiliates.
6+
* All Rights reserved.
77
* $COPYRIGHT$
88
*
99
* Additional copyrights may follow
@@ -112,6 +112,17 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if)
112112
remote_ip = (uint32_t)((struct sockaddr_in *)&(remote_if->if_addr))->sin_addr.s_addr;
113113
outgoing_interface = local_if->if_kernel_index;
114114

115+
/* If the ips are identical, assume reachable through loopback. This
116+
is done artificially due to historical reasons. With this, we can
117+
maintain similar behavior to previous implementations. */
118+
if (local_ip == remote_ip) {
119+
conn_type = "IPv4 SAME NETWORK";
120+
weight = calculate_weight(local_if->if_bandwidth,
121+
remote_if->if_bandwidth,
122+
CQ_SAME_NETWORK);
123+
goto out;
124+
}
125+
115126
ret = opal_reachable_netlink_rt_lookup(local_ip,
116127
remote_ip,
117128
outgoing_interface,
@@ -141,6 +152,18 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if)
141152
remote_ip = &((struct sockaddr_in6 *)&(remote_if->if_addr))->sin6_addr;
142153
outgoing_interface = local_if->if_kernel_index;
143154

155+
/* If the ips are identical, assume reachable through loopback. This
156+
is done artificially due to historical reasons. With this, we can
157+
maintain similar behavior to previous implementations. */
158+
if (local_ip == remote_ip) {
159+
conn_type = "IPv6 SAME NETWORK";
160+
weight = calculate_weight(local_if->if_bandwidth,
161+
remote_if->if_bandwidth,
162+
CQ_SAME_NETWORK);
163+
164+
goto out;
165+
}
166+
144167
ret = opal_reachable_netlink_rt_lookup6(local_ip,
145168
remote_ip,
146169
outgoing_interface,
@@ -171,6 +194,7 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if)
171194
weight = calculate_weight(0, 0, CQ_NO_CONNECTION);
172195
}
173196

197+
out:
174198
opal_output_verbose(20, opal_reachable_base_framework.framework_output,
175199
"reachable:netlink: path from %s to %s: %s",
176200
str_local, str_remote, conn_type);

opal/mca/reachable/reachable.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ typedef int (*opal_reachable_base_module_fini_fn_t)(void);
7575
* interfaces, but only a (comparable) reachability between any pair
7676
* of local/remote interfaces.
7777
*
78+
* This function will show an identical local and remote interface as
79+
* reachable.
7880
*
7981
*/
8082
typedef opal_reachable_t*

0 commit comments

Comments
 (0)