Commit 97cb759d authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Send requests when we lose a route.

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.
parent d9390d1f
......@@ -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
......
......@@ -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);
......
......@@ -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);
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment