- if (strcmp(e_route_cnt->dst_gateway, dst)) {
- double latency_dst;
- xbt_dynar_t route_dst;
-
- _get_route_latency(e_route_cnt->dst_gateway, dst,
- (route ? &route_dst : NULL),
- (latency ? &latency_dst : NULL));
- if (route) {
- xbt_assert(route_dst, "no route between \"%s\" and \"%s\"",
- e_route_cnt->dst_gateway, dst);
- xbt_dynar_foreach(route_dst, cpt, link) {
- xbt_dynar_push(*route, &link);
- }
- xbt_dynar_free(&route_dst);
- }
- if (latency) {
- xbt_assert(latency_dst >= 0.0,
- "latency error on route between \"%s\" and \"%s\"",
- e_route_cnt->dst_gateway, dst);
- *latency += latency_dst;
- }
+
+ /* Not in the same AS, no bypass. We'll have to find our path between the ASes recursively*/
+
+ route_t e_route_cnt = xbt_new0(s_route_t, 1);
+ e_route_cnt->link_list = xbt_dynar_new(global_routing->size_of_link, NULL);
+ common_father->get_route(common_father, src_father->name, dst_father->name, e_route_cnt);
+
+ xbt_assert(e_route_cnt, "no route between \"%s\" and \"%s\"",
+ src_father->name, dst_father->name);
+
+ xbt_assert((e_route_cnt->src_gateway == NULL) ==
+ (e_route_cnt->dst_gateway == NULL),
+ "bad gateway for route between \"%s\" and \"%s\"", src, dst);
+
+ *route = xbt_dynar_new(global_routing->size_of_link, NULL);
+
+ if (latency) {
+ *latency += common_father->get_latency(common_father,
+ src_father->name, dst_father->name,
+ e_route_cnt);
+ }
+
+
+ /* If source gateway is not our source, we have to recursively find our way up to this point */
+ if (strcmp(src, e_route_cnt->src_gateway)) {
+ double latency_src;
+ xbt_dynar_t route_src;
+
+ _get_route_and_latency(src, e_route_cnt->src_gateway,
+ (route ? &route_src : NULL),
+ (latency ? &latency_src : NULL));
+
+ xbt_assert(route_src, "no route between \"%s\" and \"%s\"",
+ src, e_route_cnt->src_gateway);
+ xbt_dynar_foreach(route_src, cpt, link) {
+ xbt_dynar_push(*route, &link);