Originate default route into stub areas.

This commit is contained in:
Ondrej Filip 2005-02-20 16:53:06 +00:00
parent 028a4cfc02
commit dafaef9ba9
2 changed files with 28 additions and 7 deletions

View file

@ -1049,10 +1049,24 @@ again2:
if ((oa == po->backbone) && oaa->trcap) fl = 1; if ((oa == po->backbone) && oaa->trcap) fl = 1;
if (oaa->stub) fl = 1;
if(fl) flush_sum_lsa(oaa, &anet->fn, ORT_NET); if(fl) flush_sum_lsa(oaa, &anet->fn, ORT_NET);
else originate_sum_lsa(oaa, &anet->fn, ORT_NET, anet->metric); else originate_sum_lsa(oaa, &anet->fn, ORT_NET, anet->metric);
} }
} }
FIB_WALK_END; 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);
}
} }
} }

View file

@ -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; u32 rtid = po->proto.cf->global->router_id;
struct ospf_lsa_header lsa; struct ospf_lsa_header lsa;
int i, max, mlen = fn->pxlen, free = 0; int i, max, mlen = fn->pxlen, free = 0;
u32 freeid = 0xFFFF;
struct ospf_lsa_sum *sum = NULL; struct ospf_lsa_sum *sum = NULL;
union ospf_lsa_sum_tm *tm; union ospf_lsa_sum_tm *tm;
lsa.type = LSA_T_SUM_NET; 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; lsa.id = ipa_to_u32(fn->prefix) + i;
if ((en = ospf_hash_find_header(po->gr, oa->areaid, &lsa)) == NULL) 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 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)) if (mlen == ipa_mklen(sum->netmask))
{ {
tm = (union ospf_lsa_sum_tm *) (sum + 1); 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; lsa.sn = en->lsa.sn + 1;
free = en->lsa.id; freeid = en->lsa.id;
free = 1;
break; break;
} }
} }
@ -486,7 +492,7 @@ originate_sum_lsa(struct ospf_area *oa, struct fib_node *fn, int type, int metri
fn->pxlen, max); fn->pxlen, max);
return; 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, OSPF_TRACE(D_EVENTS, "Originating summary (type %d) lsa for %I/%d (met %d).", lsa.type, fn->prefix,
fn->pxlen, metric); fn->pxlen, metric);
@ -537,10 +543,11 @@ check_sum_lsa(struct proto_ospf *po, ort *nf, int dest)
} }
else flush = 1; 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; flush = 1;
/* FIXME stub for networks? */
mlen = nf->fn.pxlen; mlen = nf->fn.pxlen;
ip = ipa_and(nf->fn.prefix, ipa_mkmask(mlen)); ip = ipa_and(nf->fn.prefix, ipa_mkmask(mlen));