Ignore redistributed routes filtered out.
Thanks to Dave Taht for the report.
@@ -391,6 +391,12 @@ check_xroutes(int send_updates)
i = 0;
j = 0;
while(i < numroutes || j < numxroutes) {
+ /* Ignore routes filtered out. */
+ if(i < numroutes && routes[i].metric >= INFINITY) {
+ i++;
+ continue;
+ }
+
if(i >= numroutes)
rc = +1;
else if(j >= numxroutes)
@@ -444,10 +450,7 @@ check_xroutes(int send_updates)
send_update_resend(NULL, prefix, plen, src_prefix, src_plen);
}
} else {
- /* It fits */
- if(routes[i].metric >= INFINITY) {
- flush_xroute(&xroutes[j]);
- } else if(routes[i].metric != xroutes[j].metric ||
+ if(routes[i].metric != xroutes[j].metric ||
routes[i].proto != xroutes[j].proto) {
xroutes[j].metric = routes[i].metric;
xroutes[j].proto = routes[i].proto;
@@ -455,11 +458,9 @@ check_xroutes(int send_updates)
if(send_updates)
send_update(NULL, 0, xroutes[j].prefix, xroutes[j].plen,
xroutes[j].src_prefix, xroutes[j].src_plen);
- j++;
- } else {
- j++;
}
i++;
+ j++;
}
}
