Skip to content

Commit

Permalink
Send requests when we lose a route.
Browse files Browse the repository at this point in the history
When we lose a route and have no feasible alternate, we should send requests
straight away rather than waiting for a periodic update.  If we have an
unfeasible route, send according to that route and resend, otherwise do
a multicast.
  • Loading branch information
Juliusz Chroboczek committed Aug 11, 2017
1 parent d9390d1 commit 97cb759
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
20 changes: 13 additions & 7 deletions message.c
Original file line number Diff line number Diff line change
Expand Up @@ -2032,21 +2032,27 @@ send_unicast_multihop_request(struct neighbour *neigh,
}
}

/* Send a request to a well-chosen neighbour and resend. If there is no
good neighbour, send over multicast but only once. */
void
send_request_resend(struct neighbour *neigh,
const unsigned char *prefix, unsigned char plen,
send_request_resend(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, unsigned char *id)
{
if(neigh)
struct babel_route *route;

route = find_best_route(prefix, plen, src_prefix, src_plen, 0, NULL);

if(route) {
struct neighbour *neigh = route->neigh;
send_unicast_multihop_request(neigh, prefix, plen, src_prefix, src_plen,
seqno, id, 127);
else
record_resend(RESEND_REQUEST, prefix, plen, src_prefix, src_plen, seqno,
id, neigh->ifp, resend_delay);
} else {
send_multihop_request(NULL, prefix, plen, src_prefix, src_plen,
seqno, id, 127);

record_resend(RESEND_REQUEST, prefix, plen, src_prefix, src_plen, seqno, id,
neigh ? neigh->ifp : NULL, resend_delay);
}
}

void
Expand Down
3 changes: 1 addition & 2 deletions message.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ send_unicast_multihop_request(struct neighbour *neigh,
unsigned char src_plen,
unsigned short seqno, const unsigned char *id,
unsigned short hop_count);
void send_request_resend(struct neighbour *neigh,
const unsigned char *prefix, unsigned char plen,
void send_request_resend(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix,
unsigned char src_plen,
unsigned short seqno, unsigned char *id);
Expand Down
13 changes: 8 additions & 5 deletions route.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,9 +882,10 @@ update_route(const unsigned char *id,

if(route) {
struct source *oldsrc;
unsigned short oldmetric;
unsigned short oldmetric, oldinstalled;
int lost = 0;

oldinstalled = route->installed;
oldsrc = route->src;
oldmetric = route_metric(route);

Expand Down Expand Up @@ -935,12 +936,14 @@ update_route(const unsigned char *id,
route->hold_time = hold_time;

route_changed(route, oldsrc, oldmetric);
if(!lost) {
lost = oldinstalled &&
find_installed_route(prefix, plen, src_prefix, src_plen) == NULL;
}
if(lost)
route_lost(oldsrc, oldmetric);

if(!feasible)
send_unfeasible_request(neigh, route->installed && route_old(route),
seqno, metric, src);
else if(!feasible)
send_unfeasible_request(neigh, route_old(route), seqno, metric, src);
release_source(oldsrc);
} else {
struct babel_route *new_route;
Expand Down

0 comments on commit 97cb759

Please sign in to comment.