summaryrefslogtreecommitdiffstats
path: root/proto/ospf
diff options
context:
space:
mode:
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/rt.c14
-rw-r--r--proto/ospf/topology.c21
2 files changed, 28 insertions, 7 deletions
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index 653e594..c2f7ca0 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -1049,10 +1049,24 @@ again2:
if ((oa == po->backbone) && oaa->trcap) fl = 1;
+ if (oaa->stub) fl = 1;
+
if(fl) flush_sum_lsa(oaa, &anet->fn, ORT_NET);
else originate_sum_lsa(oaa, &anet->fn, ORT_NET, anet->metric);
}
}
FIB_WALK_END;
+
+ /* Check default summary LSA for stub areas
+ * just for router connected to backbone */
+ if (po->backbone)
+ {
+ struct fib_node fnn;
+
+ fnn.prefix = IPA_NONE;
+ fnn.pxlen = 0;
+ if(oa->stub) originate_sum_lsa(oa, &fnn, ORT_NET, oa->stub);
+ else flush_sum_lsa(oa, &fnn, ORT_NET);
+ }
}
}
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index 43dbc7d..34fc316 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -441,6 +441,7 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
u32 rtid = po->proto.cf->global->router_id;
struct ospf_lsa_header lsa;
int i, max, mlen = fn->pxlen, free = 0;
+ u32 freeid = 0xFFFF;
struct ospf_lsa_sum *sum = NULL;
union ospf_lsa_sum_tm *tm;
lsa.type = LSA_T_SUM_NET;
@@ -464,7 +465,11 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
lsa.id = ipa_to_u32(fn->prefix) + i;
if ((en = ospf_hash_find_header(po->gr, oa->areaid, &lsa)) == NULL)
{
- if (!free) free = lsa.id;
+ if (!free)
+ {
+ freeid = lsa.id;
+ free = 1;
+ }
}
else
{
@@ -472,9 +477,10 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
if (mlen == ipa_mklen(sum->netmask))
{
tm = (union ospf_lsa_sum_tm *) (sum + 1);
- if (tm->metric == (unsigned)metric) return; /* No reason for origination */
+ if (tm->metric == (unsigned) metric) return; /* No reason for origination */
lsa.sn = en->lsa.sn + 1;
- free = en->lsa.id;
+ freeid = en->lsa.id;
+ free = 1;
break;
}
}
@@ -486,7 +492,7 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
fn->pxlen, max);
return;
}
- lsa.id = free;
+ lsa.id = freeid;
OSPF_TRACE(D_EVENTS, "Originating summary (type %d) lsa for %I/%d (met %d).", lsa.type, fn->prefix,
fn->pxlen, metric);
@@ -537,10 +543,11 @@ check_sum_lsa(struct proto_ospf *po, ort *nf, int dest)
}
else flush = 1;
- if ((dest == ORT_ROUTER) && oa->stub)
+ /* Don't send summary into stub areas
+ * We send just default route (and later) */
+ if (oa->stub)
flush = 1;
- /* FIXME stub for networks? */
-
+
mlen = nf->fn.pxlen;
ip = ipa_and(nf->fn.prefix, ipa_mkmask(mlen));