Commit ebaa1afd authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rewrite send_update.

parent 649ffa50
...@@ -737,7 +737,7 @@ void ...@@ -737,7 +737,7 @@ void
send_update(struct network *net, int urgent, 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, selfonly;
struct request *request; struct request *request;
if(prefix) { if(prefix) {
...@@ -758,8 +758,6 @@ send_update(struct network *net, int urgent, ...@@ -758,8 +758,6 @@ send_update(struct network *net, int urgent,
if(net == NULL) { if(net == NULL) {
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
send_update(&nets[i], urgent, prefix, plen); send_update(&nets[i], urgent, prefix, plen);
if(!nets[i].up)
continue;
} }
return; return;
} }
...@@ -767,17 +765,10 @@ send_update(struct network *net, int urgent, ...@@ -767,17 +765,10 @@ send_update(struct network *net, int urgent,
if(!net->up) if(!net->up)
return; return;
if(parasitic || (silent_time && now.tv_sec < reboot_time + silent_time)) { selfonly =
if(prefix == NULL) { parasitic || (silent_time && now.tv_sec < reboot_time + silent_time);
send_self_update(net, 0);
delay_jitter(&net->update_time, &net->update_timeout,
update_interval);
} else if(find_xroute(prefix, plen)) {
buffer_update(net, prefix, plen);
}
return;
}
if(!selfonly)
silent_time = 0; silent_time = 0;
if(prefix) { if(prefix) {
...@@ -785,19 +776,24 @@ send_update(struct network *net, int urgent, ...@@ -785,19 +776,24 @@ send_update(struct network *net, int urgent,
/* Update won't fit in current packet */ /* Update won't fit in current packet */
flushupdates(); flushupdates();
} }
if(!selfonly || find_xroute(prefix, plen)) {
debugf("Sending update to %s for %s.\n", debugf("Sending update to %s for %s.\n",
net->ifname, format_prefix(prefix, plen)); net->ifname, format_prefix(prefix, plen));
buffer_update(net, prefix, plen); buffer_update(net, prefix, plen);
}
} else { } else {
send_self_update(net, 0); send_self_update(net, 0);
/* Don't send full route dumps more than ten times per second */ /* Don't send full route dumps more than ten times per second */
if(net->update_time.tv_sec > 0 && if(net->update_time.tv_sec > 0 &&
timeval_minus_msec(&now, &net->update_time) < 100) timeval_minus_msec(&now, &net->update_time) < 100)
return; return;
if(!selfonly) {
debugf("Sending update to %s for any.\n", net->ifname); debugf("Sending update to %s for any.\n", net->ifname);
for(i = 0; i < numroutes; i++) for(i = 0; i < numroutes; i++)
if(routes[i].installed) if(routes[i].installed)
buffer_update(net, routes[i].src->prefix, routes[i].src->plen); buffer_update(net,
routes[i].src->prefix, routes[i].src->plen);
}
delay_jitter(&net->update_time, &net->update_timeout, delay_jitter(&net->update_time, &net->update_timeout,
update_interval); update_interval);
} }
......
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