+ int src_node = topo_->nodeid_from_hostid(src);
+ int dst_node = topo_->nodeid_from_hostid(dst);
+
+ if (gtnets_nodes_.find(src_node) == gtnets_nodes_.end()){
+ fprintf(stderr, "node %d not found\n", src_node);
+ return -1;
+ }
+ if (gtnets_nodes_.find(dst_node) == gtnets_nodes_.end()){
+ fprintf(stderr, "node %d not found\n", dst_node);
+ return -1;
+ }
+
+ Node* tmpsrc = gtnets_nodes_[src_node];
+ Node* tmpdst = gtnets_nodes_[dst_node];
+
+ int next_node, cur_node;
+
+ cur_node = src_node;
+ for (int i = 0; i < nlink; i++){
+ if (gtnets_nodes_.find(cur_node) == gtnets_nodes_.end()){
+ fprintf(stderr, "node %d not found\n", cur_node);
+ return -1;
+ }
+ next_node = topo_->peer_node_id(links[i], cur_node);
+ if (next_node < 0){
+ fprintf(stderr, "peer node not found\n");
+ return -1;
+ }
+ if (gtnets_nodes_.find(next_node) == gtnets_nodes_.end()){
+ fprintf(stderr, "node %d not found\n", next_node);
+ return -1;
+ }
+
+ //add route
+ Node* tmpcur = gtnets_nodes_[cur_node];
+ Node* tmpnext = gtnets_nodes_[next_node];
+
+ tmpcur->AddRoute(tmpdst->GetIPAddr(),
+ mymask,
+ tmpcur->GetIfByNode(tmpnext),
+ tmpnext->GetIPAddr());
+
+ tmpnext->AddRoute(tmpsrc->GetIPAddr(),
+ mymask,
+ tmpnext->GetIfByNode(tmpcur),
+ tmpcur->GetIPAddr());
+
+ cur_node = next_node;
+ }