Skip to content

Commit

Permalink
Ensure routing table is updated when indirect nodes go offline
Browse files Browse the repository at this point in the history
  • Loading branch information
lakeman committed Jun 11, 2013
1 parent 4e3c93e commit c6241c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion overlay_mdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions route_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -341,7 +342,7 @@ static int find_best_link(struct subscriber *subscriber)

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
Expand Down Expand Up @@ -377,7 +378,7 @@ static int find_best_link(struct subscriber *subscriber)
state->next_update = now;
}

return 0;
RETURN(0);
}

static int monitor_announce(struct subscriber *subscriber, void *context){
Expand Down
2 changes: 2 additions & 0 deletions tests/routing
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c6241c6

Please sign in to comment.