From 82329032314a289d42124d27d6665f6f0a87357a Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 8 Apr 2012 16:28:51 -1000 Subject: [PATCH] [routing] clarify why we rely on such a dirty hack --- src/surf/surf_routing.c | 8 ++++++-- src/surf/surf_routing_rulebased.c | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 0d0408b21b..a5720eae9d 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -316,8 +316,12 @@ static void routing_parse_E_ASroute(void) e_route->link_list = parsed_link_list; if (!strcmp(current_routing->model_desc->name,"RuleBased")) { - e_route->src_gateway = (sg_routing_edge_t) gw_src; // DIRTY HACK possible only FIXME - e_route->dst_gateway = (sg_routing_edge_t) gw_dst; // because of what is in routing_parse_E_ASroute + // DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields + // store the provided name instead of the entity directly (model_rulebased_parse_ASroute knows) + // + // This is because the user will provide something like "^AS_(.*)$" instead of the proper name of a given entity + e_route->src_gateway = (sg_routing_edge_t) gw_src; + e_route->dst_gateway = (sg_routing_edge_t) gw_dst; } else { e_route->src_gateway = sg_routing_edge_by_name_or_null(gw_src); e_route->dst_gateway = sg_routing_edge_by_name_or_null(gw_dst); diff --git a/src/surf/surf_routing_rulebased.c b/src/surf/surf_routing_rulebased.c index e7aecf4619..c2230321c9 100644 --- a/src/surf/surf_routing_rulebased.c +++ b/src/surf/surf_routing_rulebased.c @@ -131,8 +131,13 @@ static void model_rulebased_parse_ASroute(AS_t rc, erroffset, dst, error); ruleroute_e->generic_rule_route.re_str_link = route->link_list; - ruleroute_e->re_src_gateway = xbt_strdup((char *)route->src_gateway); // DIRTY HACK possible only - ruleroute_e->re_dst_gateway = xbt_strdup((char *)route->dst_gateway); // because of what is in routing_parse_E_ASroute + + // DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields + // store the provided name instead of the entity directly (routing_parse_E_ASroute knows) + // + // This is because the user will provide something like "^AS_(.*)$" instead of the proper name of a given entity + ruleroute_e->re_src_gateway = xbt_strdup((char *)route->src_gateway); + ruleroute_e->re_dst_gateway = xbt_strdup((char *)route->dst_gateway); xbt_dynar_push(routing->list_ASroute, &ruleroute_e); /* make sure that they don't get freed */ -- 2.20.1