Commit 22be80a1 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Ignore networks that are not up.

parent bf0887fe
...@@ -386,6 +386,8 @@ main(int argc, char **argv) ...@@ -386,6 +386,8 @@ main(int argc, char **argv)
/* Make some noise so that others notice us */ /* Make some noise so that others notice us */
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
send_hello(&nets[i]); send_hello(&nets[i]);
send_request(&nets[i], NULL, 0, 0, 0, 0); send_request(&nets[i], NULL, 0, 0, 0, 0);
...@@ -394,6 +396,8 @@ main(int argc, char **argv) ...@@ -394,6 +396,8 @@ main(int argc, char **argv)
} }
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
send_hello(&nets[i]); send_hello(&nets[i]);
send_self_update(&nets[i], 0); send_self_update(&nets[i], 0);
...@@ -415,6 +419,8 @@ main(int argc, char **argv) ...@@ -415,6 +419,8 @@ main(int argc, char **argv)
if(request_resend_time) if(request_resend_time)
timeval_min_sec(&tv, request_resend_time); timeval_min_sec(&tv, request_resend_time);
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
timeval_min(&tv, &nets[i].flush_time); timeval_min(&tv, &nets[i].flush_time);
timeval_min_sec(&tv, timeval_min_sec(&tv,
nets[i].hello_time + nets[i].hello_interval); nets[i].hello_time + nets[i].hello_interval);
...@@ -464,6 +470,8 @@ main(int argc, char **argv) ...@@ -464,6 +470,8 @@ main(int argc, char **argv)
} }
} else { } else {
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
if(nets[i].ifindex == sin6.sin6_scope_id) { if(nets[i].ifindex == sin6.sin6_scope_id) {
parse_packet((unsigned char*)&sin6.sin6_addr, &nets[i], parse_packet((unsigned char*)&sin6.sin6_addr, &nets[i],
buf, rc); buf, rc);
...@@ -502,6 +510,8 @@ main(int argc, char **argv) ...@@ -502,6 +510,8 @@ main(int argc, char **argv)
} }
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
if(now.tv_sec >= nets[i].hello_time + nets[i].hello_interval) if(now.tv_sec >= nets[i].hello_time + nets[i].hello_interval)
send_hello(&nets[i]); send_hello(&nets[i]);
if(now.tv_sec >= nets[i].ihu_time + nets[i].ihu_interval) if(now.tv_sec >= nets[i].ihu_time + nets[i].ihu_interval)
...@@ -525,6 +535,8 @@ main(int argc, char **argv) ...@@ -525,6 +535,8 @@ main(int argc, char **argv)
} }
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
if(nets[i].flush_time.tv_sec != 0) { if(nets[i].flush_time.tv_sec != 0) {
if(timeval_compare(&now, &nets[i].flush_time) >= 0) if(timeval_compare(&now, &nets[i].flush_time) >= 0)
flushbuf(&nets[i]); flushbuf(&nets[i]);
...@@ -546,6 +558,8 @@ main(int argc, char **argv) ...@@ -546,6 +558,8 @@ main(int argc, char **argv)
} }
} }
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
/* Retract exported routes. */ /* Retract exported routes. */
send_self_retract(&nets[i]); send_self_retract(&nets[i]);
/* Make sure that we expire quickly from our neighbours' /* Make sure that we expire quickly from our neighbours'
...@@ -556,6 +570,8 @@ main(int argc, char **argv) ...@@ -556,6 +570,8 @@ main(int argc, char **argv)
usleep(50000 + random() % 100000); usleep(50000 + random() % 100000);
} }
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
/* Make sure they got it. */ /* Make sure they got it. */
send_self_retract(&nets[i]); send_self_retract(&nets[i]);
send_hello_noupdate(&nets[i], 1); send_hello_noupdate(&nets[i], 1);
...@@ -605,8 +621,11 @@ main(int argc, char **argv) ...@@ -605,8 +621,11 @@ main(int argc, char **argv)
exit(1); exit(1);
fail: fail:
for(i = 0; i < numnets; i++) for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
kernel_setup_interface(0, nets[i].ifname, nets[i].ifindex); kernel_setup_interface(0, nets[i].ifname, nets[i].ifindex);
}
kernel_setup_socket(0); kernel_setup_socket(0);
kernel_setup(0, do_ipv4); kernel_setup(0, do_ipv4);
exit(1); exit(1);
......
...@@ -465,8 +465,11 @@ send_request(struct network *net, ...@@ -465,8 +465,11 @@ send_request(struct network *net,
int i; int i;
if(net == NULL) { if(net == NULL) {
for(i = 0; i < numnets; i++) for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
send_request(&nets[i], prefix, plen, hop_count, seqno, router_hash); send_request(&nets[i], prefix, plen, hop_count, seqno, router_hash);
}
return; return;
} }
...@@ -697,8 +700,11 @@ send_update(struct network *net, int urgent, ...@@ -697,8 +700,11 @@ 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;
} }
...@@ -753,8 +759,11 @@ send_self_update(struct network *net, int force_seqno) ...@@ -753,8 +759,11 @@ send_self_update(struct network *net, int force_seqno)
update_myseqno(force_seqno); update_myseqno(force_seqno);
if(net == NULL) { if(net == NULL) {
for(i = 0; i < numnets; i++) for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
send_self_update(&nets[i], 0); send_self_update(&nets[i], 0);
}
return; return;
} }
...@@ -774,8 +783,11 @@ send_self_retract(struct network *net) ...@@ -774,8 +783,11 @@ send_self_retract(struct network *net)
int i; int i;
if(net == NULL) { if(net == NULL) {
for(i = 0; i < numnets; i++) for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
send_self_retract(&nets[i]); send_self_retract(&nets[i]);
}
return; return;
} }
...@@ -811,8 +823,11 @@ send_ihu(struct neighbour *neigh, struct network *net) ...@@ -811,8 +823,11 @@ send_ihu(struct neighbour *neigh, struct network *net)
unsigned short interval; unsigned short interval;
if(neigh == NULL && net == NULL) { if(neigh == NULL && net == NULL) {
for(i = 0; i < numnets; i++) for(i = 0; i < numnets; i++) {
if(!nets[i].up)
continue;
send_ihu(NULL, &nets[i]); send_ihu(NULL, &nets[i]);
}
return; return;
} }
......
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