Commit c2248ea1 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Change sending strategy for IHUs.

IHUs are now sent synchronously with hellos.  There's no longer an explicit
IHU interval, we send IHUs for all neighbours every three hellos, and for
marginal neighbours with each hello.
parent 140a4bfc
......@@ -661,8 +661,6 @@ main(int argc, char **argv)
continue;
if(timeval_compare(&now, &nets[i].hello_timeout) >= 0)
send_hello(&nets[i]);
if(timeval_compare(&now, &nets[i].ihu_timeout) >= 0)
send_ihu(NULL, &nets[i]);
if(!network_idle(&nets[i])) {
if(timeval_compare(&now, &nets[i].update_timeout) >= 0)
send_update(&nets[i], 0, NULL, 0);
......
......@@ -167,7 +167,7 @@ parse_packet(const unsigned char *from, struct network *net,
hop_count);
if(plen == 0xFF) {
/* 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_update(neigh->network, 0, NULL, 0);
} else {
......@@ -494,8 +494,11 @@ send_hello(struct network *net)
int changed;
changed = update_hello_interval(net);
send_hello_noupdate(net, (net->hello_interval + 9) / 10);
if(changed)
/* Send full IHU every 3 hellos, and marginal IHU each time */
if(changed || net->hello_seqno % 3 == 0)
send_ihu(NULL, net);
else
send_marginal_ihu(net);
}
void
......@@ -944,8 +947,6 @@ send_ihu(struct neighbour *neigh, struct network *net)
send_ihu(&neighs[i], net);
}
}
delay_jitter(&net->ihu_time, &net->ihu_timeout,
net->ihu_interval);
} else {
int rxcost, interval;
......@@ -956,7 +957,7 @@ send_ihu(struct neighbour *neigh, struct network *net)
rxcost = neighbour_rxcost(neigh);
interval = (net->ihu_interval + 9) / 10;
interval = (net->hello_interval * 3 + 9) / 10;
debugf("Sending ihu %d on %s to %s (%s).\n",
rxcost,
......@@ -968,3 +969,16 @@ send_ihu(struct neighbour *neigh, struct network *net)
rxcost, neigh->id);
}
}
/* Send IHUs to all marginal neighbours */
void
send_marginal_ihu(struct network *net)
{
int i;
for(i = 0; i < numneighs; i++) {
if(neighs[i].hello_seqno == -2 || (net && neighs[i].network != net))
continue;
if(neighs[i].txcost >= 384 || (neighs[i].reach & 0xF000) != 0xF000)
send_ihu(&neighs[i], net);
}
}
......@@ -63,15 +63,6 @@ void send_update(struct network *net, int urgent,
void update_myseqno(int force);
void send_self_update(struct network *net, int force_seqno);
void send_ihu(struct neighbour *neigh, struct network *net);
void send_marginal_ihu(struct network *net);
void schedule_flush_now(struct network *net);
void flushupdates(void);
......@@ -196,16 +196,12 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
}
}
/* If this neighbour is marginal, make sure to give it plenty of
feedback. */
if((neigh->reach & 0xE000) != 0xE000 && (neigh->reach & 0xE000) != 0x0000)
send_ihu(neigh, NULL);
if((neigh->reach & 0xFC00) == 0xC000) {
/* This is a newish neighbour. If we don't have another route to it,
request a full route dump. This assumes that the neighbour's id
is also its IP address and that it is exporting a route to itself. */
struct route *route = NULL;
send_ihu(neigh, NULL);
if(!martian_prefix(neigh->id, 128))
route = find_installed_route(neigh->id, 128);
if(!route || route->metric >= INFINITY || route->neigh == neigh)
......
......@@ -94,11 +94,6 @@ update_hello_interval(struct network *net)
}
}
if(net->ihu_interval != 3 * net->hello_interval) {
net->ihu_interval = 3 * net->hello_interval;
rc = 1;
}
net->self_update_interval =
MAX(update_interval / 2, net->hello_interval);
......@@ -250,8 +245,6 @@ network_up(struct network *net, int up)
}
delay_jitter(&net->hello_time, &net->hello_timeout,
net->hello_interval);
delay_jitter(&net->ihu_time, &net->ihu_timeout,
net->ihu_interval);
delay_jitter(&net->self_update_time, &net->self_update_timeout,
net->self_update_interval);
delay_jitter(&net->update_time, &net->update_timeout,
......
......@@ -31,8 +31,6 @@ struct network {
struct timeval self_update_timeout;
struct timeval update_time;
struct timeval update_timeout;
struct timeval ihu_time;
struct timeval ihu_timeout;
char ifname[IF_NAMESIZE];
unsigned char *ipv4;
int buffered;
......@@ -45,7 +43,6 @@ struct network {
unsigned short hello_seqno;
unsigned int hello_interval;
unsigned int self_update_interval;
unsigned int ihu_interval;
};
extern struct network nets[MAXNETS];
......
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