OSPF: Fix net-summary origination combined with stubnet option

Stubnet nodes in OSPF FIB were removed during rt_sync(), but the pointer
remained in top_hash_entry.nf, so net-summary LSA origination was
confused, reported 'LSA ID collision' and net-summary LSAs were not
originated properly.

Thanks to Naveen Chowdary Yerramneni for bugreport and analysis.
This commit is contained in:
Ondrej Zajicek (work) 2016-12-13 17:34:42 +01:00
parent ed1a908e53
commit 9e7d3a7810
2 changed files with 11 additions and 7 deletions

View file

@ -429,10 +429,9 @@ add_network(struct ospf_area *oa, ip_addr px, int pxlen, int metric, struct top_
if (en == oa->rt) if (en == oa->rt)
{ {
/* /*
* Local stub networks does not have proper iface in en->nhi * Local stub networks do not have proper iface in en->nhi (because they all
* (because they all have common top_hash_entry en). * have common top_hash_entry en). We have to find iface responsible for
* We have to find iface responsible for that stub network. * that stub network. Configured stubnets do not have any iface. They will
* Configured stubnets does not have any iface. They will
* be removed in rt_sync(). * be removed in rt_sync().
*/ */
@ -1560,6 +1559,7 @@ ospf_rt_reset(struct ospf_proto *p)
{ {
ri = (ort *) nftmp; ri = (ort *) nftmp;
ri->area_net = 0; ri->area_net = 0;
ri->keep = 0;
reset_ri(ri); reset_ri(ri);
} }
FIB_WALK_END; FIB_WALK_END;
@ -1929,9 +1929,12 @@ again1:
} }
} }
/* Remove configured stubnets */ /* Remove configured stubnets but keep the entries */
if (!nf->n.nhs) if (nf->n.type && !nf->n.nhs)
{
reset_ri(nf); reset_ri(nf);
nf->keep = 1;
}
if (nf->n.type) /* Add the route */ if (nf->n.type) /* Add the route */
{ {
@ -1991,7 +1994,7 @@ again1:
} }
/* Remove unused rt entry, some special entries are persistent */ /* 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_ITERATE_PUT(&fit, nftmp);
fib_delete(fib, nftmp); fib_delete(fib, nftmp);

View file

@ -84,6 +84,7 @@ typedef struct ort
rta *old_rta; rta *old_rta;
u8 external_rte; u8 external_rte;
u8 area_net; u8 area_net;
u8 keep;
} }
ort; ort;