summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2005-02-12 23:22:18 +0100
committerOndrej Filip <feela@network.cz>2005-02-12 23:22:18 +0100
commit89ba9a18068dc83557e03c58bf280f4dc203271d (patch)
tree81fbbac84890f7ce2c80ef36302afc049bda8bbd /proto
parentbae7c43ff35482807654519253b1daa0a6518951 (diff)
downloadbird-89ba9a18068dc83557e03c58bf280f4dc203271d.tar
bird-89ba9a18068dc83557e03c58bf280f4dc203271d.zip
Bugfix in inter-area route calculation and summary LSA origination.
Bugfix of some debugging commands.
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/rt.c39
-rw-r--r--proto/ospf/topology.c15
2 files changed, 37 insertions, 17 deletions
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index 8604ebe..ca1f58d 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -214,10 +214,7 @@ ospf_rt_spfa(struct ospf_area *oa)
* it's also correct.
*/
DBG("\n");
- if (act == oa->rt)
- continue;
- if (!act->nhi)
- continue;
+
nf.type = RTS_OSPF;
nf.capa = 0;
nf.metric1 = act->dist + rtl->metric;
@@ -226,6 +223,26 @@ ospf_rt_spfa(struct ospf_area *oa)
nf.ar = act;
nf.nh = act->nh;
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),
ipa_mklen(ipa_from_u32(rtl->data)), ORT_NET, &nf, NULL);
break;
@@ -458,7 +475,7 @@ ospf_rt_sum(struct ospf_area *oa)
int mlen = -1, type = -1;
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)
{
@@ -467,9 +484,6 @@ ospf_rt_sum(struct ospf_area *oa)
/* Page 169 (1) */
if (en->lsa.age == LSA_MAXAGE)
continue;
- if (en->dist == LSINFINITY)
- continue;
-
/* Page 169 (2) */
if (en->lsa.rt == p->cf->global->router_id)
continue;
@@ -478,6 +492,10 @@ ospf_rt_sum(struct ospf_area *oa)
continue;
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)
{
@@ -500,8 +518,6 @@ ospf_rt_sum(struct ospf_area *oa)
if (abr->n.metric1 == LSINFINITY) continue;
if (!(abr->n.capa & ORTA_ABR)) continue;
- tm = (union ospf_lsa_sum_tm *)(mask + 1);
-
nf.type = RTS_OSPF_IA;
nf.capa = ORTA_ABR;
nf.metric1 = abr->n.metric1 + (tm->metric & METRIC_MASK);
@@ -933,6 +949,9 @@ again1:
a0.aflags = 0;
a0.iface = nf->n.ifa;
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)))
{
int found = 0;
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index b0c97b3..5ba41e8 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -108,8 +108,8 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 * length)
if (ifa->state == OSPF_IS_WAITING)
{
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->id = ipa_to_u32(ifa->iface->addr->prefix) & ln->data;
ln->metric = ifa->cost;
ln->notos = 0;
}
@@ -134,8 +134,8 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 * length)
else
{
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->id = ipa_to_u32(ifa->iface->addr->prefix) & ln->data;
ln->metric = ifa->cost;
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;
- OSPF_TRACE(D_EVENTS, "Originating summary (type %d) lsa for %I/%d.", lsa.type, fn->prefix,
- fn->pxlen);
+ OSPF_TRACE(D_EVENTS, "Originating summary (type %d) lsa for %I/%d (met %d).", lsa.type, fn->prefix,
+ fn->pxlen, metric);
sum = mb_alloc(p->pool, sizeof(struct ospf_lsa_sum) + sizeof(union ospf_lsa_sum_tm));
sum->netmask = ipa_mkmask(mlen);
@@ -847,7 +847,7 @@ ospf_hash_delete(struct top_graph *f, struct top_hash_entry *e)
void
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);
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];
while (e)
{
- OSPF_TRACE(D_EVENTS, "\t%1x %-1I %-1I %4u 0x%08x 0x%04x",
- e->lsa.type, e->lsa.id, e->lsa.rt, e->lsa.age, e->lsa.sn, e->lsa.checksum);
+ 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->oa ? e->oa->areaid : 0 );
e = e->next;
}
}