[Xorp-hackers] A question about delete_route() in xorp/bgp/route_table_decision.cc

Yi Wang yiwang at cs.princeton.edu
Mon Aug 21 09:48:19 PDT 2006


Hello,

I was looking at the delete_route() function in route_table_decision.cc
of the BGP implementation of XORP 1.3. I found the following snippet of 
code a bit confusing: what if the old_winner (old_winner_clone) and the 
new_winner are the same, but they both refer to the route to be deleted 
(the one in rtmsg)? If it is the case and we return -1 here, the 
delete_route message won't be propagate downstream.

if (old_winner_clone != NULL) {
     if (new_winner != NULL
         && old_winner_clone->route() == new_winner->route()) {
         //the winner didn't change.
         XLOG_ASSERT(old_winner_clone != NULL);
         delete old_winner_clone;
         return -1;
     }
     ...
}

My guess is that there is some statement missing in the following "if"
statement, at least the comment doesn't seems to match the statement 
below it. Maybe the author meant to delete the old_winner from 
alternatives before selecting the new_winner?

if (!alternatives.empty()) {
     //add the new route to the pool of possible winners.
     new_winner = find_winner(alternatives);
}

My apology if I made some dumb mistake here.

Thanks a lot!
Yi





More information about the Xorp-hackers mailing list