1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Fixes a bug in duplicit configured stubnets.

If there was the same configured stubnet on local and remote
router, the remote route always won regardless of its cost.
This commit is contained in:
Ondrej Zajicek
2010-05-26 12:32:30 +02:00
parent 52572e94ec
commit e0a62ad0f8
2 changed files with 15 additions and 7 deletions

View File

@@ -244,14 +244,12 @@ add_network(struct ospf_area *oa, ip_addr px, int pxlen, int metric, struct top_
* 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.
* Some stubnets does not have any iface. Ignore them.
* Configured stubnets does not have any iface. They will
* be removed in rt_sync().
*/
nf.ifa = find_stub_src(oa, px, pxlen);
nf.nh = IPA_NONE;
if (!nf.ifa)
return;
}
ri_install_net(oa->po, px, pxlen, &nf);
@@ -813,7 +811,7 @@ decide_sum_lsa(struct ospf_area *oa, ort *nf, int dest)
return 0;
/* 12.4.3 p4 */
if (nf->n.ifa->oa->areaid == oa->areaid)
if (nf->n.ifa && (nf->n.ifa->oa->areaid == oa->areaid))
return 0;
/* 12.4.3 p5 */
@@ -961,7 +959,7 @@ ospf_rt_abr(struct proto_ospf *po)
/* RFC 2328 G.3 - incomplete resolution of virtual next hops */
if (nf->n.type && (nf->n.ifa->type == OSPF_IT_VLINK))
if (nf->n.type && nf->n.ifa && (nf->n.ifa->type == OSPF_IT_VLINK))
reset_ri(&nf->n);
@@ -1153,6 +1151,10 @@ ospf_ext_spf(struct proto_ospf *po)
if ((nf2->n.type != RTS_OSPF) && (nf2->n.type != RTS_OSPF_IA))
continue;
/* Next-hop is a part of a configured stubnet */
if (!nf2->n.ifa)
continue;
/* If nh is zero, it is a device route */
nh = ipa_nonzero(nf2->n.nh) ? nf2->n.nh : rt_fwaddr;
nhi = nf2->n.ifa;
@@ -1539,6 +1541,10 @@ again1:
if (po->areano > 1)
check_sum_net_lsa(po, nf);
/* Remove configured stubnets */
if (!nf->n.ifa)
reset_ri(&nf->n);
if (reload || memcmp(&nf->n, &nf->o, sizeof(orta)))
{
net *ne = net_get(p->table, nf->fn.prefix, nf->fn.pxlen);