Stub networks done.

This commit is contained in:
Ondrej Filip 2000-04-26 20:16:36 +00:00
parent 5904a51266
commit 2add26dfa9

View file

@ -8,13 +8,19 @@
#include "ospf.h" #include "ospf.h"
/* FIXME next hop calculation
* FIXME sync with BIRD's routing table
*/
void void
ospf_rt_spfa(struct ospf_area *oa, struct proto *p) ospf_rt_spfa(struct ospf_area *oa, struct proto *p)
{ {
struct top_hash_entry *en; struct top_hash_entry *en, *nx;
slab *sl; slab *sl;
struct spf_n *cn; struct spf_n *cn;
u32 i,*rts; u32 i,*rts;
struct ospf_lsa_rt *rt;
struct ospf_lsa_rt_link *rtl;
/* /*
* First of all, mark all vertices as they are not in SPF * First of all, mark all vertices as they are not in SPF
@ -42,8 +48,6 @@ ospf_rt_spfa(struct ospf_area *oa, struct proto *p)
{ {
struct top_hash_entry *act,*tmp; struct top_hash_entry *act,*tmp;
node *n; node *n;
struct ospf_lsa_rt *rt;
struct ospf_lsa_rt_link *rtl;
struct ospf_lsa_net *net; struct ospf_lsa_net *net;
n=HEAD(oa->cand); n=HEAD(oa->cand);
@ -92,6 +96,35 @@ ospf_rt_spfa(struct ospf_area *oa, struct proto *p)
break; break;
} }
} }
/* Now calculate routes to stub networks */
WALK_SLIST_DELSAFE(SNODE en, SNODE nx, oa->lsal)
{
if((en->lsa.type==LSA_T_RT)||(en->lsa.type==LSA_T_NET))
{
if(en->dist==LSINFINITY)
{
s_rem_node(SNODE en);
/* FIXME Remove from routing table! */
mb_free(en->lsa_body);
ospf_hash_delete(oa->gr, en);
}
if(en->lsa.type==LSA_T_NET)
{
rt=(struct ospf_lsa_rt *)en->lsa_body;
if((rt->VEB)&(1>>LSA_RT_V)) oa->trcap=1;
rtl=(struct ospf_lsa_rt_link *)(rt+1);
for(i=0;rt->links;i++)
{
if((rtl+i)->type==LSART_STUB)
{
/* Check destination and so on (pg 166) */
}
}
}
}
}
} }
void void
@ -110,7 +143,8 @@ add_cand(list *l, struct top_hash_entry *en, u16 dist, slab *s)
if(dist==en->dist) if(dist==en->dist)
{ {
//Next hop calc //Add Next hop
//And add it to routing table (Multiple path?)
} }
else else
{ {
@ -150,5 +184,7 @@ add_cand(list *l, struct top_hash_entry *en, u16 dist, slab *s)
break; break;
} }
} }
/* FIXME Some VLINK staff should be here */
/* Routing table add?*/
} }
} }