Install route into main routing table just if it's necessary.

This commit is contained in:
Ondrej Filip 2001-06-12 21:10:30 +00:00
parent c48b33292b
commit 24c00cb119
2 changed files with 51 additions and 30 deletions

View file

@ -14,7 +14,9 @@ init_infib(struct fib_node *fn)
struct infib *f=(struct infib *)fn; struct infib *f=(struct infib *)fn;
f->metric=LSINFINITY; f->metric=LSINFINITY;
f->oldmetric=LSINFINITY;
f->en=NULL; f->en=NULL;
f->olden=NULL;
} }
void void
@ -26,6 +28,9 @@ init_efib(struct fib_node *fn)
f->metric2=LSINFINITY; f->metric2=LSINFINITY;
f->nh=ipa_from_u32(0); f->nh=ipa_from_u32(0);
f->nhi=NULL; f->nhi=NULL;
f->oldmetric=LSINFINITY;
f->oldmetric2=LSINFINITY;
f->oldnh=ipa_from_u32(0);
} }
/** /**
@ -211,6 +216,7 @@ again:
en->nhi=nn->iface; en->nhi=nn->iface;
} }
if((nf->en!=nf->olden)||(nf->metric!=nf->oldmetric))
{ {
net *ne; net *ne;
rta a0; rta a0;
@ -241,6 +247,9 @@ again:
DBG("Modifying rt entry %I\n (GW: %I, Iface: %s)\n", DBG("Modifying rt entry %I\n (GW: %I, Iface: %s)\n",
nf->fn.prefix,en->nh,en->nhi->name); nf->fn.prefix,en->nh,en->nhi->name);
rte_update(p->table, ne, p, e); rte_update(p->table, ne, p, e);
nf->olden=nf->en;
nf->oldmetric=nf->metric;
} }
} }
@ -480,6 +489,8 @@ noch:
goto noch; goto noch;
} }
else else
if((nf->metric!=nf->oldmetric)||(nf->metric2!=nf->oldmetric2)||
(!ipa_equal(nf->nh,nf->oldnh))||(nf->tag!=nf->oldtag))
{ {
net *ne; net *ne;
rta a0; rta a0;
@ -507,6 +518,11 @@ noch:
DBG("Modifying rt entry %I\n (IP: %I, GW: %I)\n", DBG("Modifying rt entry %I\n (IP: %I, GW: %I)\n",
nf->fn.prefix,ip,nf->nh); nf->fn.prefix,ip,nf->nh);
rte_update(p->table, ne, p, e); rte_update(p->table, ne, p, e);
nf->oldmetric=nf->metric;
nf->oldmetric2=nf->metric2;
nf->oldnh=nf->nh;
nf->oldtag=nf->tag;
} }
} }
let: let:

View file

@ -13,8 +13,9 @@
struct infib { struct infib {
struct fib_node fn; struct fib_node fn;
u16 metric; u16 metric;
u16 pad; u16 oldmetric;
struct top_hash_entry *en; struct top_hash_entry *en;
struct top_hash_entry *olden;
}; };
struct extfib { struct extfib {
@ -24,6 +25,10 @@ struct extfib {
ip_addr nh; ip_addr nh;
u32 tag; u32 tag;
struct iface *nhi; struct iface *nhi;
u16 oldmetric;
u16 oldmetric2;
ip_addr oldnh;
u32 oldtag;
}; };
void ospf_rt_spfa(struct ospf_area *oa); void ospf_rt_spfa(struct ospf_area *oa);