diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index fcf23fc6..e3df74c8 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -73,7 +73,7 @@ ospf_age(struct ospf_area *oa) en->lsa.age = 0; en->inst_t = now; en->ini_age = 0; - lsasum_calculate(&en->lsa, en->lsa_body, po); + lsasum_calculate(&en->lsa, en->lsa_body); ospf_lsupd_flood(NULL, NULL, &en->lsa, NULL, oa, 1); continue; } @@ -321,7 +321,7 @@ ntohlsab(void *n, void *h, u8 type, u16 len) /* FIXME This is VERY uneficient, I have huge endianity problems */ void -lsasum_calculate(struct ospf_lsa_header *h, void *body, struct proto_ospf *po) +lsasum_calculate(struct ospf_lsa_header *h, void *body) { u16 length; @@ -330,7 +330,7 @@ lsasum_calculate(struct ospf_lsa_header *h, void *body, struct proto_ospf *po) htonlsah(h, h); htonlsab(body, body, h->type, length - sizeof(struct ospf_lsa_header)); - (void) lsasum_check(h, body, po); + (void) lsasum_check(h, body); ntohlsah(h, h); ntohlsab(body, body, h->type, length - sizeof(struct ospf_lsa_header)); @@ -341,7 +341,7 @@ lsasum_calculate(struct ospf_lsa_header *h, void *body, struct proto_ospf *po) * It also returns value in big endian */ u16 -lsasum_check(struct ospf_lsa_header *h, void *body, struct proto_ospf *po) +lsasum_check(struct ospf_lsa_header *h, void *body) { u8 *sp, *ep, *p, *q, *b; int c0 = 0, c1 = 0; diff --git a/proto/ospf/lsalib.h b/proto/ospf/lsalib.h index cde30de8..43f95130 100644 --- a/proto/ospf/lsalib.h +++ b/proto/ospf/lsalib.h @@ -14,10 +14,8 @@ void htonlsah(struct ospf_lsa_header *h, struct ospf_lsa_header *n); void ntohlsah(struct ospf_lsa_header *n, struct ospf_lsa_header *h); void htonlsab(void *h, void *n, u8 type, u16 len); void ntohlsab(void *n, void *h, u8 type, u16 len); -void lsasum_calculate(struct ospf_lsa_header *header, void *body, - struct proto_ospf *p); -u16 lsasum_check(struct ospf_lsa_header *h, void *body, - struct proto_ospf *po); +void lsasum_calculate(struct ospf_lsa_header *header, void *body); +u16 lsasum_check(struct ospf_lsa_header *h, void *body); #define CMP_NEWER 1 #define CMP_SAME 0 #define CMP_OLDER -1 diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index d9065672..52531bf5 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -350,7 +350,7 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps, /* pg 143 (1) */ chsum = lsa->checksum; - if (chsum != lsasum_check(lsa, NULL, po)) + if (chsum != lsasum_check(lsa, NULL)) { log(L_WARN "Received bad lsa checksum from %I", n->ip); continue; @@ -433,7 +433,7 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps, OSPF_TRACE(D_EVENTS, "Premature aging self originated lsa."); OSPF_TRACE(D_EVENTS, "Type: %d, Id: %I, Rt: %I", lsatmp.type, lsatmp.id, lsatmp.rt); - lsasum_check(lsa, (lsa + 1), po); /* It also calculates chsum! */ + lsasum_check(lsa, (lsa + 1)); /* It also calculates chsum! */ lsatmp.checksum = ntohs(lsa->checksum); ospf_lsupd_flood(NULL, lsa, &lsatmp, NULL, oa, 0); if (en = ospf_hash_find_header(oa->gr, &lsatmp)) @@ -566,7 +566,7 @@ ospf_lsupd_flush_nlsa(struct top_hash_entry *en, struct ospf_area *oa) lsa->age = LSA_MAXAGE; lsa->sn = LSA_MAXSEQNO; - lsasum_calculate(lsa, en->lsa_body, po); + lsasum_calculate(lsa, en->lsa_body); OSPF_TRACE(D_EVENTS, "Premature aging self originated lsa!"); OSPF_TRACE(D_EVENTS, "Type: %d, Id: %I, Rt: %I", lsa->type, lsa->id, lsa->rt); diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index c3f4c321..2527cef1 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -57,9 +57,9 @@ ospf_neighbor_new(struct ospf_iface *ifa) n->rxmt_timer->hook = rxmt_timer_hook; n->rxmt_timer->recurrent = ifa->rxmtint; s_init_list(&(n->lsrql)); - n->lsrqh = ospf_top_new(pool, n->ifa->proto); + n->lsrqh = ospf_top_new(pool); s_init_list(&(n->lsrtl)); - n->lsrth = ospf_top_new(pool, n->ifa->proto); + n->lsrth = ospf_top_new(pool); s_init(&(n->lsrqi), &(n->lsrql)); s_init(&(n->lsrti), &(n->lsrtl)); tm_start(n->rxmt_timer, n->ifa->rxmtint); diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 302f56df..d3067e86 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -114,7 +114,7 @@ ospf_start(struct proto *p) oa->stub = ac->stub; oa->tick = ac->tick; oa->areaid = ac->areaid; - oa->gr = ospf_top_new(po->proto.pool, po); + oa->gr = ospf_top_new(p->pool); s_init_list(&(oa->lsal)); oa->rt = NULL; oa->po = po; @@ -175,8 +175,6 @@ static struct proto * ospf_init(struct proto_config *c) { struct proto *p = proto_new(c, sizeof(struct proto_ospf)); - struct proto_ospf *po = (struct proto_ospf *) p; - struct ospf_config *oc = (struct ospf_config *) c; p->import_control = ospf_import_control; p->make_tmp_attrs = ospf_make_tmp_attrs; diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 75e074a7..f1e691cc 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -198,7 +198,7 @@ originate_rt_lsa(struct ospf_area *oa) lsa.sn = oa->rt->lsa.sn + 1; } body = originate_rt_lsa_body(oa, &lsa.length); - lsasum_calculate(&lsa, body, po); + lsasum_calculate(&lsa, body); en = lsa_install_new(&lsa, body, oa); oa->rt = en; en->dist = 0; /* Force area aging */ @@ -299,7 +299,7 @@ originate_net_lsa(struct ospf_iface *ifa) } body = originate_net_lsa_body(ifa, &lsa.length, po); - lsasum_calculate(&lsa, body, po); + lsasum_calculate(&lsa, body); ifa->nlsa = lsa_install_new(&lsa, body, ifa->oa); ospf_lsupd_flood(NULL, NULL, &ifa->nlsa->lsa, NULL, ifa->oa, 1); ifa->orignet = 0; @@ -437,7 +437,7 @@ originate_ext_lsa(net * n, rte * e, struct proto_ospf *po, mb_free(body); return; } - lsasum_calculate(&lsa, body, po); + lsasum_calculate(&lsa, body); WALK_LIST(oa, po->area_list) { en = lsa_install_new(&lsa, body, oa); @@ -514,7 +514,7 @@ ospf_top_hash(struct top_graph *f, u32 lsaid, u32 rtrid, u32 type) * its used in @ospf_area structure. */ struct top_graph * -ospf_top_new(pool * pool, struct proto_ospf *p) +ospf_top_new(pool *pool) { struct top_graph *f; diff --git a/proto/ospf/topology.h b/proto/ospf/topology.h index 5baa0c9e..55ecb4fe 100644 --- a/proto/ospf/topology.h +++ b/proto/ospf/topology.h @@ -44,7 +44,7 @@ struct top_graph unsigned int hash_entries_min, hash_entries_max; }; -struct top_graph *ospf_top_new(pool *, struct proto_ospf *); +struct top_graph *ospf_top_new(pool *); void ospf_top_free(struct top_graph *); void ospf_top_dump(struct top_graph *, struct proto *); struct top_hash_entry *ospf_hash_find_header(struct top_graph *f,