On Wed, Nov 30, 2016 at 08:25:32PM +0530, naveen chowdary Yerramneni wrote: > Regd #6, all stubnetworks are explicitly removed from FIB in rt_sync(), not > due to any external event. Pasted the code sniplet below for reference.
Hi The attached patch should fix the bug. The FIB entry is not removed in this case so the FIB node remains valid and is reused in the next recalculation. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santi...@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 19f2d07..21aaf14 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -429,10 +429,9 @@ add_network(struct ospf_area *oa, ip_addr px, int pxlen, int metric, struct top_ if (en == oa->rt) { /* - * Local stub networks does not have proper iface in en->nhi - * (because they all have common top_hash_entry en). - * We have to find iface responsible for that stub network. - * Configured stubnets does not have any iface. They will + * Local stub networks do not have proper iface in en->nhi (because they all + * have common top_hash_entry en). We have to find iface responsible for + * that stub network. Configured stubnets do not have any iface. They will * be removed in rt_sync(). */ @@ -1560,6 +1559,7 @@ ospf_rt_reset(struct ospf_proto *p) { ri = (ort *) nftmp; ri->area_net = 0; + ri->keep = 0; reset_ri(ri); } FIB_WALK_END; @@ -1929,9 +1929,12 @@ again1: } } - /* Remove configured stubnets */ - if (!nf->n.nhs) + /* Remove configured stubnets but keep the entries */ + if (nf->n.type && !nf->n.nhs) + { reset_ri(nf); + nf->keep = 1; + } if (nf->n.type) /* Add the route */ { @@ -1991,7 +1994,7 @@ again1: } /* Remove unused rt entry, some special entries are persistent */ - if (!nf->n.type && !nf->external_rte && !nf->area_net) + if (!nf->n.type && !nf->external_rte && !nf->area_net && !nf->keep) { FIB_ITERATE_PUT(&fit, nftmp); fib_delete(fib, nftmp); diff --git a/proto/ospf/rt.h b/proto/ospf/rt.h index 30332f3..73b2837 100644 --- a/proto/ospf/rt.h +++ b/proto/ospf/rt.h @@ -84,6 +84,7 @@ typedef struct ort rta *old_rta; u8 external_rte; u8 area_net; + u8 keep; } ort;