|
2 | 2 | /*
|
3 | 3 | * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
4 | 4 | * 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. |
7 | 7 | * $COPYRIGHT$
|
8 | 8 | *
|
9 | 9 | * Additional copyrights may follow
|
@@ -112,6 +112,17 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if)
|
112 | 112 | remote_ip = (uint32_t)((struct sockaddr_in *)&(remote_if->if_addr))->sin_addr.s_addr;
|
113 | 113 | outgoing_interface = local_if->if_kernel_index;
|
114 | 114 |
|
| 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 | + |
115 | 126 | ret = opal_reachable_netlink_rt_lookup(local_ip,
|
116 | 127 | remote_ip,
|
117 | 128 | outgoing_interface,
|
@@ -141,6 +152,18 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if)
|
141 | 152 | remote_ip = &((struct sockaddr_in6 *)&(remote_if->if_addr))->sin6_addr;
|
142 | 153 | outgoing_interface = local_if->if_kernel_index;
|
143 | 154 |
|
| 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 | + |
144 | 167 | ret = opal_reachable_netlink_rt_lookup6(local_ip,
|
145 | 168 | remote_ip,
|
146 | 169 | outgoing_interface,
|
@@ -171,6 +194,7 @@ static int get_weights(opal_if_t *local_if, opal_if_t *remote_if)
|
171 | 194 | weight = calculate_weight(0, 0, CQ_NO_CONNECTION);
|
172 | 195 | }
|
173 | 196 |
|
| 197 | +out: |
174 | 198 | opal_output_verbose(20, opal_reachable_base_framework.framework_output,
|
175 | 199 | "reachable:netlink: path from %s to %s: %s",
|
176 | 200 | str_local, str_remote, conn_type);
|
|
0 commit comments