diff options
author | Ondrej Filip <feela@network.cz> | 2000-06-07 22:31:47 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-06-07 22:31:47 +0000 |
commit | e9ab0b4212dc0939d782c991c86c362e09eb279f (patch) | |
tree | c3f963af420cbc13a847bd52344930396c65a4e5 /proto/ospf | |
parent | d5e4b51865c9532a9b886e942d30bb64dc87a675 (diff) |
Doc in lsalib.c + related minor changes.
Diffstat (limited to 'proto/ospf')
-rw-r--r-- | proto/ospf/Doc | 1 | ||||
-rw-r--r-- | proto/ospf/lsalib.c | 30 | ||||
-rw-r--r-- | proto/ospf/lsalib.h | 4 | ||||
-rw-r--r-- | proto/ospf/lsupd.c | 2 | ||||
-rw-r--r-- | proto/ospf/topology.c | 6 |
5 files changed, 33 insertions, 10 deletions
diff --git a/proto/ospf/Doc b/proto/ospf/Doc index 8b8906ff..3cc298f8 100644 --- a/proto/ospf/Doc +++ b/proto/ospf/Doc @@ -3,3 +3,4 @@ S topology.c S neighbor.c S iface.c S packet.c +S lsalib.c diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index 46b6d09d..cd294214 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -1,7 +1,7 @@ /* * BIRD -- OSPF * - * (c) 1999-2000 Ondrej Filip <feela@network.cz> + * (c) 1999 - 2000 Ondrej Filip <feela@network.cz> * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -18,6 +18,18 @@ flush_lsa(struct top_hash_entry *en, struct ospf_area *oa) ospf_hash_delete(oa->gr,en); } +/** + * ospf_age + * @oa: ospf area + * + * This function is periodicaly invoked from area_disp(). It computes new + * age of all LSAs and old (@age is higher than %LSA_MAXAGE) are flushed + * when ever possible. If some LSA originated by router itself is older + * than %LSREFRESHTIME new instance is originated. + * + * RFC says, that router should check checksum of every LSA to detect some + * hardware problem. BIRD does not do it to minimalize CPU utilization. + */ void ospf_age(struct ospf_area *oa) { @@ -379,11 +391,21 @@ lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2) return CMP_SAME; } -/* LSA can be temporarrily, but body must be mb_alloced. */ +/** + * lsa_install_new - install new LSA into database + * @lsa: LSA header + * @body pointer to LSA body + * @oa: current ospf_area + * + * This function ensures installing new LSA into LSA database. Old instance is + * replaced. Several actions are taken to detec if new routing table + * calculation is necessary. This is described in 13.2 of RFC 2328. + */ struct top_hash_entry * -lsa_install_new(struct ospf_lsa_header *lsa, void *body, struct ospf_area *oa, - struct proto *p) +lsa_install_new(struct ospf_lsa_header *lsa, void *body, struct ospf_area *oa) { + /* LSA can be temporarrily, but body must be mb_alloced. */ + struct proto *p=&oa->po->proto; int change=0; unsigned i; struct top_hash_entry *en; diff --git a/proto/ospf/lsalib.h b/proto/ospf/lsalib.h index 4c74bc48..5722e8ef 100644 --- a/proto/ospf/lsalib.h +++ b/proto/ospf/lsalib.h @@ -1,7 +1,7 @@ /* * BIRD -- OSPF * - * (c) 2000 Ondrej Filip <feela@network.cz> + * (c) 1999 - 2000 Ondrej Filip <feela@network.cz> * * Can be freely distributed and used under the terms of the GNU GPL. * @@ -22,7 +22,7 @@ u16 lsasum_check(struct ospf_lsa_header *h,void *body,struct proto_ospf *po); #define CMP_OLDER -1 int lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2); struct top_hash_entry *lsa_install_new(struct ospf_lsa_header *lsa, void *body, - struct ospf_area *oa, struct proto *p); + struct ospf_area *oa); void ospf_age(struct ospf_area *oa); void flush_lsa(struct top_hash_entry *en, struct ospf_area *oa); diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index a5f2b794..57d95752 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -425,7 +425,7 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p, body=mb_alloc(p->pool,lsatmp.length-sizeof(struct ospf_lsa_header)); ntohlsab(lsa+1,body,lsatmp.type, lsatmp.length-sizeof(struct ospf_lsa_header)); - lsadb=lsa_install_new(&lsatmp,body, oa, p); + lsadb=lsa_install_new(&lsatmp,body, oa); DBG("New LSA installed in DB\n"); continue; diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 3b3f8064..8affb1ff 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -205,7 +205,7 @@ originate_rt_lsa(struct ospf_area *oa) } body=originate_rt_lsa_body(oa, &lsa.length, po); lsasum_calculate(&lsa,body,po); - en=lsa_install_new(&lsa, body, oa, &po->proto); + en=lsa_install_new(&lsa, body, oa); oa->rt=en; flood_lsa(NULL,NULL,&oa->rt->lsa,po,NULL,oa,1); schedule_rtcalc(oa); @@ -297,7 +297,7 @@ originate_net_lsa(struct ospf_iface *ifa) body=originate_net_lsa_body(ifa, &lsa.length, po); lsasum_calculate(&lsa,body,po); - ifa->nlsa=lsa_install_new(&lsa, body, ifa->oa, &po->proto); + ifa->nlsa=lsa_install_new(&lsa, body, ifa->oa); flood_lsa(NULL,NULL,&ifa->nlsa->lsa,po,NULL,ifa->oa,1); } @@ -401,7 +401,7 @@ originate_ext_lsa(net *n, rte *e, struct proto_ospf *po, struct ea_list *attrs) lsasum_calculate(&lsa,body,po); WALK_LIST(oa, po->area_list) { - en=lsa_install_new(&lsa, body, oa, &po->proto); + en=lsa_install_new(&lsa, body, oa); flood_lsa(NULL,NULL,&en->lsa,po,NULL,oa,1); body=originate_ext_lsa_body(n, e, po, attrs); } |