Commit 757d5e1e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rework and simplify send_triggered_update.

Triggered updates are no longer sent when a route gets better.
parent 5742abbd
...@@ -521,8 +521,9 @@ void ...@@ -521,8 +521,9 @@ void
send_triggered_update(struct route *route, struct source *oldsrc, send_triggered_update(struct route *route, struct source *oldsrc,
unsigned oldmetric) unsigned oldmetric)
{ {
int urgent = 0;
unsigned newmetric, diff; unsigned newmetric, diff;
/* 1 means send speedily, 2 means resend */
int urgent;
if(!route->installed) if(!route->installed)
return; return;
...@@ -533,24 +534,27 @@ send_triggered_update(struct route *route, struct source *oldsrc, ...@@ -533,24 +534,27 @@ send_triggered_update(struct route *route, struct source *oldsrc,
if(route->src != oldsrc || (oldmetric < INFINITY && newmetric >= INFINITY)) if(route->src != oldsrc || (oldmetric < INFINITY && newmetric >= INFINITY))
/* Switching sources can cause transient routing loops. /* Switching sources can cause transient routing loops.
Retractions are always urgent. */ Retractions can cause blackholes. */
urgent = 2; urgent = 2;
else if(newmetric >= 6 * 256 && oldmetric >= 6 * 256) else if(newmetric > oldmetric && oldmetric < 6 * 256 && diff >= 512)
/* Don't be noisy about far-away nodes */ /* Route getting significantly worse */
urgent = -1;
else if(diff >= 512)
urgent = 1; urgent = 1;
else if(unsatisfied_request(route->src->prefix, route->src->plen,
/* Make sure that requests are satisfied speedily */ route->seqno, route->src->id))
if(urgent < 1) { /* Make sure that requests are satisfied speedily */
if(unsatisfied_request(route->src->prefix, route->src->plen, urgent = 1;
route->seqno, route->src->id)) else if(oldmetric >= INFINITY && newmetric < INFINITY)
urgent = 1; /* New route */
} urgent = 0;
else if(newmetric < oldmetric && diff < 1024)
if(urgent < 0 || (!urgent && diff < 384)) /* Route getting better. This may be a transient fluctuation, so
/* Never mind. */ don't advertise it to avoid making routes unfeasible later on. */
return;
else if(diff < 384)
/* Don't fret about trivialities */
return; return;
else
urgent = 0;
if(urgent >= 2) if(urgent >= 2)
send_update_resend(NULL, route->src->prefix, route->src->plen); send_update_resend(NULL, route->src->prefix, route->src->plen);
......
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