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,37 +765,35 @@ send_update(struct network *net, int urgent, ...@@ -767,37 +765,35 @@ 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;
}
silent_time = 0; if(!selfonly)
silent_time = 0;
if(prefix) { if(prefix) {
if(updates > net->bufsize / 24 - 2) { if(updates > net->bufsize / 24 - 2) {
/* Update won't fit in current packet */ /* Update won't fit in current packet */
flushupdates(); flushupdates();
} }
debugf("Sending update to %s for %s.\n", if(!selfonly || find_xroute(prefix, plen)) {
net->ifname, format_prefix(prefix, plen)); debugf("Sending update to %s for %s.\n",
buffer_update(net, prefix, plen); net->ifname, format_prefix(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;
debugf("Sending update to %s for any.\n", net->ifname); if(!selfonly) {
for(i = 0; i < numroutes; i++) debugf("Sending update to %s for any.\n", net->ifname);
if(routes[i].installed) for(i = 0; i < numroutes; i++)
buffer_update(net, routes[i].src->prefix, routes[i].src->plen); if(routes[i].installed)
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