Bugfix in inter-area route calculation and summary LSA origination.
Bugfix of some debugging commands.
This commit is contained in:
parent
bae7c43ff3
commit
89ba9a1806
2 changed files with 37 additions and 17 deletions
|
@ -214,10 +214,7 @@ ospf_rt_spfa(struct ospf_area *oa)
|
||||||
* it's also correct.
|
* it's also correct.
|
||||||
*/
|
*/
|
||||||
DBG("\n");
|
DBG("\n");
|
||||||
if (act == oa->rt)
|
|
||||||
continue;
|
|
||||||
if (!act->nhi)
|
|
||||||
continue;
|
|
||||||
nf.type = RTS_OSPF;
|
nf.type = RTS_OSPF;
|
||||||
nf.capa = 0;
|
nf.capa = 0;
|
||||||
nf.metric1 = act->dist + rtl->metric;
|
nf.metric1 = act->dist + rtl->metric;
|
||||||
|
@ -226,6 +223,26 @@ ospf_rt_spfa(struct ospf_area *oa)
|
||||||
nf.ar = act;
|
nf.ar = act;
|
||||||
nf.nh = act->nh;
|
nf.nh = act->nh;
|
||||||
nf.ifa = act->nhi;
|
nf.ifa = act->nhi;
|
||||||
|
|
||||||
|
if (act == oa->rt)
|
||||||
|
{
|
||||||
|
struct ospf_iface *iff;
|
||||||
|
|
||||||
|
WALK_LIST(iff, po->iface_list)
|
||||||
|
{
|
||||||
|
if (rtl->id == (ipa_to_u32(ipa_mkmask(iff->iface->addr->pxlen))
|
||||||
|
& ipa_to_u32(iff->iface->addr->prefix)))
|
||||||
|
{
|
||||||
|
nf.ifa = iff->iface;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nf.ifa)
|
||||||
|
continue;
|
||||||
|
|
||||||
ri_install(po, ipa_from_u32(rtl->id),
|
ri_install(po, ipa_from_u32(rtl->id),
|
||||||
ipa_mklen(ipa_from_u32(rtl->data)), ORT_NET, &nf, NULL);
|
ipa_mklen(ipa_from_u32(rtl->data)), ORT_NET, &nf, NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -458,7 +475,7 @@ ospf_rt_sum(struct ospf_area *oa)
|
||||||
int mlen = -1, type = -1;
|
int mlen = -1, type = -1;
|
||||||
union ospf_lsa_sum_tm *tm;
|
union ospf_lsa_sum_tm *tm;
|
||||||
|
|
||||||
OSPF_TRACE(D_EVENTS, "Starting routing table calculation for inter-area routes");
|
OSPF_TRACE(D_EVENTS, "Starting routing table calculation for inter-area (area %I)", oa->areaid);
|
||||||
|
|
||||||
WALK_SLIST(en, po->lsal)
|
WALK_SLIST(en, po->lsal)
|
||||||
{
|
{
|
||||||
|
@ -467,9 +484,6 @@ ospf_rt_sum(struct ospf_area *oa)
|
||||||
/* Page 169 (1) */
|
/* Page 169 (1) */
|
||||||
if (en->lsa.age == LSA_MAXAGE)
|
if (en->lsa.age == LSA_MAXAGE)
|
||||||
continue;
|
continue;
|
||||||
if (en->dist == LSINFINITY)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Page 169 (2) */
|
/* Page 169 (2) */
|
||||||
if (en->lsa.rt == p->cf->global->router_id)
|
if (en->lsa.rt == p->cf->global->router_id)
|
||||||
continue;
|
continue;
|
||||||
|
@ -478,6 +492,10 @@ ospf_rt_sum(struct ospf_area *oa)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mask = (ip_addr *)en->lsa_body;
|
mask = (ip_addr *)en->lsa_body;
|
||||||
|
tm = (union ospf_lsa_sum_tm *)(mask + 1);
|
||||||
|
|
||||||
|
if((tm->metric & METRIC_MASK) == LSINFINITY)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (en->lsa.type == LSA_T_SUM_NET)
|
if (en->lsa.type == LSA_T_SUM_NET)
|
||||||
{
|
{
|
||||||
|
@ -500,8 +518,6 @@ ospf_rt_sum(struct ospf_area *oa)
|
||||||
if (abr->n.metric1 == LSINFINITY) continue;
|
if (abr->n.metric1 == LSINFINITY) continue;
|
||||||
if (!(abr->n.capa & ORTA_ABR)) continue;
|
if (!(abr->n.capa & ORTA_ABR)) continue;
|
||||||
|
|
||||||
tm = (union ospf_lsa_sum_tm *)(mask + 1);
|
|
||||||
|
|
||||||
nf.type = RTS_OSPF_IA;
|
nf.type = RTS_OSPF_IA;
|
||||||
nf.capa = ORTA_ABR;
|
nf.capa = ORTA_ABR;
|
||||||
nf.metric1 = abr->n.metric1 + (tm->metric & METRIC_MASK);
|
nf.metric1 = abr->n.metric1 + (tm->metric & METRIC_MASK);
|
||||||
|
@ -933,6 +949,9 @@ again1:
|
||||||
a0.aflags = 0;
|
a0.aflags = 0;
|
||||||
a0.iface = nf->n.ifa;
|
a0.iface = nf->n.ifa;
|
||||||
a0.gw = nf->n.nh;
|
a0.gw = nf->n.nh;
|
||||||
|
|
||||||
|
if (ipa_equal(nf->n.nh, IPA_NONE)) a0.dest = RTD_DEVICE;
|
||||||
|
|
||||||
if ((!ipa_equal(nf->n.nh, IPA_NONE)) && (!neigh_find(p, &nf->n.nh, 0)))
|
if ((!ipa_equal(nf->n.nh, IPA_NONE)) && (!neigh_find(p, &nf->n.nh, 0)))
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
|
@ -108,8 +108,8 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 * length)
|
||||||
if (ifa->state == OSPF_IS_WAITING)
|
if (ifa->state == OSPF_IS_WAITING)
|
||||||
{
|
{
|
||||||
ln->type = LSART_STUB;
|
ln->type = LSART_STUB;
|
||||||
ln->id = ipa_to_u32(ifa->iface->addr->prefix);
|
|
||||||
ln->data = ipa_to_u32(ipa_mkmask(ifa->iface->addr->pxlen));
|
ln->data = ipa_to_u32(ipa_mkmask(ifa->iface->addr->pxlen));
|
||||||
|
ln->id = ipa_to_u32(ifa->iface->addr->prefix) & ln->data;
|
||||||
ln->metric = ifa->cost;
|
ln->metric = ifa->cost;
|
||||||
ln->notos = 0;
|
ln->notos = 0;
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,8 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 * length)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ln->type = LSART_STUB;
|
ln->type = LSART_STUB;
|
||||||
ln->id = ipa_to_u32(ifa->iface->addr->prefix);
|
|
||||||
ln->data = ipa_to_u32(ipa_mkmask(ifa->iface->addr->pxlen));
|
ln->data = ipa_to_u32(ipa_mkmask(ifa->iface->addr->pxlen));
|
||||||
|
ln->id = ipa_to_u32(ifa->iface->addr->prefix) & ln->data;
|
||||||
ln->metric = ifa->cost;
|
ln->metric = ifa->cost;
|
||||||
ln->notos = 0;
|
ln->notos = 0;
|
||||||
}
|
}
|
||||||
|
@ -483,8 +483,8 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
|
||||||
}
|
}
|
||||||
lsa.id = free;
|
lsa.id = free;
|
||||||
|
|
||||||
OSPF_TRACE(D_EVENTS, "Originating summary (type %d) lsa for %I/%d.", lsa.type, fn->prefix,
|
OSPF_TRACE(D_EVENTS, "Originating summary (type %d) lsa for %I/%d (met %d).", lsa.type, fn->prefix,
|
||||||
fn->pxlen);
|
fn->pxlen, metric);
|
||||||
|
|
||||||
sum = mb_alloc(p->pool, sizeof(struct ospf_lsa_sum) + sizeof(union ospf_lsa_sum_tm));
|
sum = mb_alloc(p->pool, sizeof(struct ospf_lsa_sum) + sizeof(union ospf_lsa_sum_tm));
|
||||||
sum->netmask = ipa_mkmask(mlen);
|
sum->netmask = ipa_mkmask(mlen);
|
||||||
|
@ -847,7 +847,7 @@ ospf_hash_delete(struct top_graph *f, struct top_hash_entry *e)
|
||||||
void
|
void
|
||||||
ospf_top_dump(struct top_graph *f, struct proto *p)
|
ospf_top_dump(struct top_graph *f, struct proto *p)
|
||||||
{
|
{
|
||||||
unsigned int i; /* FIXME: Print areaids */
|
unsigned int i;
|
||||||
OSPF_TRACE(D_EVENTS, "Hash entries: %d", f->hash_entries);
|
OSPF_TRACE(D_EVENTS, "Hash entries: %d", f->hash_entries);
|
||||||
|
|
||||||
for (i = 0; i < f->hash_size; i++)
|
for (i = 0; i < f->hash_size; i++)
|
||||||
|
@ -855,8 +855,9 @@ ospf_top_dump(struct top_graph *f, struct proto *p)
|
||||||
struct top_hash_entry *e = f->hash_table[i];
|
struct top_hash_entry *e = f->hash_table[i];
|
||||||
while (e)
|
while (e)
|
||||||
{
|
{
|
||||||
OSPF_TRACE(D_EVENTS, "\t%1x %-1I %-1I %4u 0x%08x 0x%04x",
|
OSPF_TRACE(D_EVENTS, "- %1x %-1I %-1I %4u 0x%08x 0x%04x %-1I",
|
||||||
e->lsa.type, e->lsa.id, e->lsa.rt, e->lsa.age, e->lsa.sn, e->lsa.checksum);
|
e->lsa.type, e->lsa.id, e->lsa.rt, e->lsa.age,
|
||||||
|
e->lsa.sn, e->lsa.checksum, e->oa ? e->oa->areaid : 0 );
|
||||||
e = e->next;
|
e = e->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue