Commit 2391e74a authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add a parameter ``urgent'' to send_update.

parent 1410e881
...@@ -502,7 +502,7 @@ main(int argc, char **argv) ...@@ -502,7 +502,7 @@ main(int argc, char **argv)
send_ihu(NULL, &nets[i]); send_ihu(NULL, &nets[i]);
if(!network_idle(&nets[i])) { if(!network_idle(&nets[i])) {
if(now.tv_sec >= nets[i].update_time + update_interval) if(now.tv_sec >= nets[i].update_time + update_interval)
send_update(&nets[i], NULL, 0); send_update(&nets[i], 0, NULL, 0);
if(now.tv_sec >= if(now.tv_sec >=
nets[i].self_update_time + nets[i].self_update_interval) { nets[i].self_update_time + nets[i].self_update_interval) {
send_self_update(&nets[i], 0); send_self_update(&nets[i], 0);
...@@ -533,7 +533,7 @@ main(int argc, char **argv) ...@@ -533,7 +533,7 @@ main(int argc, char **argv)
/* Uninstall and retract all routes. */ /* Uninstall and retract all routes. */
if(routes[i].installed) { if(routes[i].installed) {
uninstall_route(&routes[i]); uninstall_route(&routes[i]);
send_update(NULL, routes[i].src->prefix, routes[i].src->plen); send_update(NULL, 1, routes[i].src->prefix, routes[i].src->plen);
} }
} }
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
......
...@@ -150,9 +150,9 @@ parse_packet(const unsigned char *from, struct network *net, ...@@ -150,9 +150,9 @@ parse_packet(const unsigned char *from, struct network *net,
/* If a neighbour is requesting a full route dump from us, /* If a neighbour is requesting a full route dump from us,
we might as well send it an ihu. */ we might as well send it an ihu. */
send_ihu(neigh, NULL); send_ihu(neigh, NULL);
send_update(neigh->network, NULL, 0); send_update(neigh->network, 0, NULL, 0);
} else { } else {
send_update(neigh->network, address, plen); send_update(neigh->network, 1, address, plen);
} }
} else if(type == 3) { } else if(type == 3) {
if(plen == 0xFF) if(plen == 0xFF)
...@@ -556,14 +556,14 @@ buffer_update(struct network *net, ...@@ -556,14 +556,14 @@ buffer_update(struct network *net,
} }
void void
send_update(struct network *net, send_update(struct network *net, int urgent,
const unsigned char *prefix, unsigned char plen) const unsigned char *prefix, unsigned char plen)
{ {
int i; int i;
if(net == NULL) { if(net == NULL) {
for(i = 0; i < numnets; i++) for(i = 0; i < numnets; i++)
send_update(&nets[i], prefix, plen); send_update(&nets[i], urgent, prefix, plen);
return; return;
} }
...@@ -582,7 +582,7 @@ send_update(struct network *net, ...@@ -582,7 +582,7 @@ send_update(struct network *net,
if(prefix) { if(prefix) {
if(updates > net->bufsize / 24 - 2) { if(updates > net->bufsize / 24 - 2) {
/* Update won't fit in a single packet -- send a full dump. */ /* Update won't fit in a single packet -- send a full dump. */
send_update(net, NULL, 0); send_update(net, urgent, NULL, 0);
return; return;
} }
debugf("Sending update to %s for %s.\n", debugf("Sending update to %s for %s.\n",
...@@ -622,9 +622,8 @@ send_self_update(struct network *net, int force_seqno) ...@@ -622,9 +622,8 @@ send_self_update(struct network *net, int force_seqno)
for(i = 0; i < numxroutes; i++) { for(i = 0; i < numxroutes; i++) {
if(xroutes[i].exported) if(xroutes[i].exported)
send_update(net, xroutes[i].prefix, xroutes[i].plen); send_update(net, 0, xroutes[i].prefix, xroutes[i].plen);
} }
schedule_update_flush(net);
} }
void void
...@@ -659,7 +658,7 @@ send_neighbour_update(struct neighbour *neigh, struct network *net) ...@@ -659,7 +658,7 @@ send_neighbour_update(struct neighbour *neigh, struct network *net)
int i; int i;
for(i = 0; i < numroutes; i++) { for(i = 0; i < numroutes; i++) {
if(routes[i].installed && routes[i].nexthop == neigh) if(routes[i].installed && routes[i].nexthop == neigh)
send_update(net, routes[i].src->prefix, routes[i].src->plen); send_update(net, 0, routes[i].src->prefix, routes[i].src->plen);
} }
} }
......
...@@ -44,7 +44,7 @@ void send_request(struct network *net, ...@@ -44,7 +44,7 @@ void send_request(struct network *net,
const unsigned char *prefix, unsigned char plen); const unsigned char *prefix, unsigned char plen);
void send_unicast_request(struct neighbour *neigh, void send_unicast_request(struct neighbour *neigh,
const unsigned char *prefix, unsigned char plen); const unsigned char *prefix, unsigned char plen);
void send_update(struct network *net, void send_update(struct network *net, int urgent,
const unsigned char *prefix, unsigned char plen); const unsigned char *prefix, unsigned char plen);
void send_self_update(struct network *net, int force_seqno); void send_self_update(struct network *net, int force_seqno);
void send_self_retract(struct network *net); void send_self_retract(struct network *net);
......
...@@ -435,7 +435,7 @@ consider_route(struct route *route) ...@@ -435,7 +435,7 @@ consider_route(struct route *route)
if(installed && route->installed) if(installed && route->installed)
send_triggered_update(route, installed->src, installed->metric); send_triggered_update(route, installed->src, installed->metric);
else else
send_update(NULL, route->src->prefix, route->src->plen); send_update(NULL, 0, route->src->prefix, route->src->plen);
return; return;
} }
...@@ -450,7 +450,8 @@ send_triggered_update(struct route *route, struct source *oldsrc, int oldmetric) ...@@ -450,7 +450,8 @@ send_triggered_update(struct route *route, struct source *oldsrc, int oldmetric)
if(route->src != oldsrc || if(route->src != oldsrc ||
((route->metric >= INFINITY) != (oldmetric >= INFINITY)) || ((route->metric >= INFINITY) != (oldmetric >= INFINITY)) ||
(route->metric >= oldmetric + 256 || oldmetric >= route->metric + 256)) (route->metric >= oldmetric + 256 || oldmetric >= route->metric + 256))
send_update(NULL, route->src->prefix, route->src->plen); send_update(NULL, ((route->metric >= INFINITY) || route->src != oldsrc),
route->src->prefix, route->src->plen);
if(oldmetric < INFINITY) { if(oldmetric < INFINITY) {
if(route->metric >= INFINITY || route->metric - oldmetric >= 384) if(route->metric >= INFINITY || route->metric - oldmetric >= 384)
...@@ -495,7 +496,7 @@ route_lost(struct source *src, int oldmetric) ...@@ -495,7 +496,7 @@ route_lost(struct source *src, int oldmetric)
consider_route(new_route); consider_route(new_route);
} else { } else {
/* Complain loudly. */ /* Complain loudly. */
send_update(NULL, src->prefix, src->plen); send_update(NULL, 1, src->prefix, src->plen);
if(oldmetric < INFINITY) if(oldmetric < INFINITY)
send_request(NULL, src->prefix, src->plen); send_request(NULL, src->prefix, 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