diff --git a/nest/rt-table.c b/nest/rt-table.c index 14101d6c..7f2d1f6e 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -3462,20 +3462,55 @@ rt_next_hop_update_net(struct rtable_private *tab, struct netindex *ni, net *n) n->routes = new; } + /* Now we have to announce the routes the right way, to not cause any + * strange problems with consistency. */ + + ASSERT_DIE(updates[0].old == old_best); + + /* Find new best route original position */ + uint nbpos = ~0; + for (uint i=0; ireq, &updates[nbpos].new, + best_indicator[1][0]); + rte_announce(tab, ni, n, + &updates[nbpos].new_stored->rte, &updates[nbpos].old->rte, + &new->rte, &old_best->rte); + } + else + nbpos = 0; + uint total = 0; /* Announce the changes */ for (uint i=0; irte.src == updates[i].new.src), ob = (i == 0); - const char *best_indicator[2][2] = { - { "autoupdated", "autoupdated [-best]" }, - { "autoupdated [+best]", "autoupdated [best]" } - }; rt_rte_trace_in(D_ROUTES, updates[i].new.sender->req, &updates[i].new, best_indicator[nb][ob]); - rte_announce(tab, ni, n, &updates[i].new_stored->rte, &updates[i].old->rte, &new->rte, &old_best->rte); + rte_announce(tab, ni, n, + &updates[i].new_stored->rte, &updates[i].old->rte, + &new->rte, (!nbpos && !i) ? &old_best->rte : &new->rte); total++; }