Ensure routing table is updated when indirect nodes go offline

This commit is contained in:
Jeremy Lakeman 2013-06-11 10:17:41 +09:30
parent 4e3c93e00a
commit c6241c6634
3 changed files with 9 additions and 6 deletions

View File

@ -835,7 +835,7 @@ static int routing_table(struct subscriber *subscriber, void *context){
reply.packetTypeAndFlags=MDP_TX;
reply.out.payload_length=sizeof(struct overlay_route_record);
memcpy(r->sid, subscriber->sid, SID_SIZE);
r->reachable = subscriber_is_reachable(subscriber);
r->reachable = subscriber->reachable;
if (subscriber->reachable==REACHABLE_INDIRECT && subscriber->next_hop)
memcpy(r->neighbour, subscriber->next_hop->sid, SID_SIZE);

View File

@ -274,15 +274,16 @@ static void update_path_score(struct neighbour *neighbour, struct link *link){
static int find_best_link(struct subscriber *subscriber)
{
IN();
if (subscriber->reachable==REACHABLE_SELF)
return 0;
RETURN(0);
struct link_state *state = get_link_state(subscriber);
if (state->route_version == route_version)
return 0;
RETURN(0);
if (state->calculating)
return -1;
RETURN(-1);
state->calculating = 1;
struct neighbour *neighbour = neighbours;
@ -341,7 +342,7 @@ next:
int reachable = subscriber->reachable;
if (next_hop == NULL){
if (subscriber->reachable&REACHABLE_BROADCAST && !(subscriber->reachable & REACHABLE_ASSUMED))
if ((subscriber->reachable&REACHABLE_DIRECT) != REACHABLE_UNICAST)
reachable = REACHABLE_NONE;
} else if (next_hop == subscriber){
// reset the state of any unicast probe's if the interface has changed
@ -377,7 +378,7 @@ next:
state->next_update = now;
}
return 0;
RETURN(0);
}
static int monitor_announce(struct subscriber *subscriber, void *context){

View File

@ -373,6 +373,8 @@ test_lose_neighbours() {
stop_servald_server +B
foreach_instance +A +C \
wait_until --timeout=30 instance_offline +B
set_instance +A
wait_until --timeout=30 instance_offline +C
start_servald_server +B
wait_until path_exists +A +B +C
wait_until path_exists +C +B +A