... and a whole bunch of unused parameters and variables in ospf.

This commit is contained in:
Martin Mares 2004-06-05 09:28:17 +00:00
parent c91fc9b606
commit 1512813e95
11 changed files with 7 additions and 53 deletions

View file

@ -154,7 +154,6 @@ ospf_dbdes_reqladd(struct ospf_dbdes_packet *ps, struct ospf_neighbor *n)
struct top_hash_entry *he, *sn; struct top_hash_entry *he, *sn;
struct top_graph *gr = n->ifa->oa->gr; struct top_graph *gr = n->ifa->oa->gr;
struct ospf_packet *op; struct ospf_packet *op;
struct proto *p = (struct proto *) n->ifa->proto;
int i, j; int i, j;
op = (struct ospf_packet *) ps; op = (struct ospf_packet *) ps;

View file

@ -13,13 +13,12 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
struct ospf_iface *ifa, int size, ip_addr faddr) struct ospf_iface *ifa, int size, ip_addr faddr)
{ {
u32 nrid, *pnrid; u32 nrid, *pnrid;
struct ospf_neighbor *neigh, *n; struct ospf_neighbor *n;
u8 i, twoway, oldpriority; u8 i, twoway, oldpriority;
ip_addr olddr, oldbdr; ip_addr olddr, oldbdr;
ip_addr mask; ip_addr mask;
char *beg = "Bad OSPF hello packet from ", *rec = " received: "; char *beg = "Bad OSPF hello packet from ", *rec = " received: ";
int eligible = 0; int eligible = 0;
pool *pool;
struct proto *p = (struct proto *) ifa->proto; struct proto *p = (struct proto *) ifa->proto;
nrid = ntohl(((struct ospf_packet *) ps)->routerid); nrid = ntohl(((struct ospf_packet *) ps)->routerid);

View file

@ -116,7 +116,6 @@ downint(struct ospf_iface *ifa)
{ {
struct ospf_neighbor *n,*nx; struct ospf_neighbor *n,*nx;
struct proto *p=&ifa->proto->proto; struct proto *p=&ifa->proto->proto;
struct proto_ospf *po=ifa->proto;
WALK_LIST_DELSAFE(n,nx,ifa->neigh_list) WALK_LIST_DELSAFE(n,nx,ifa->neigh_list)
{ {
@ -149,7 +148,6 @@ void
ospf_int_sm(struct ospf_iface *ifa, int event) ospf_int_sm(struct ospf_iface *ifa, int event)
{ {
struct proto *p=(struct proto *)(ifa->proto); struct proto *p=(struct proto *)(ifa->proto);
struct proto_ospf *po=ifa->proto;
struct ospf_area *oa=ifa->oa; struct ospf_area *oa=ifa->oa;
OSPF_TRACE(D_EVENTS, "SM on iface %s. Event is \"%s\".", OSPF_TRACE(D_EVENTS, "SM on iface %s. Event is \"%s\".",
@ -324,9 +322,6 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface)
struct ospf_iface *ifa; struct ospf_iface *ifa;
struct object_lock *lock; struct object_lock *lock;
struct nbma_node *nbma,*nb; struct nbma_node *nbma,*nb;
u8 i;
sock *mcsk;
DBG("%s: If notify called\n", p->name); DBG("%s: If notify called\n", p->name);
if (iface->flags & IF_IGNORE) if (iface->flags & IF_IGNORE)
@ -457,7 +452,6 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface)
void void
ospf_iface_info(struct ospf_iface *ifa) ospf_iface_info(struct ospf_iface *ifa)
{ {
int x;
char *strict="(strict)"; char *strict="(strict)";
if((ifa->type!=OSPF_IT_NBMA)||(ifa->strictnbma==0)) strict=""; if((ifa->type!=OSPF_IT_NBMA)||(ifa->strictnbma==0)) strict="";

View file

@ -124,7 +124,6 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps,
u32 nrid, myrid; u32 nrid, myrid;
struct ospf_neighbor *n; struct ospf_neighbor *n;
struct ospf_lsa_header lsa, *plsa; struct ospf_lsa_header lsa, *plsa;
int length;
u16 nolsa, i; u16 nolsa, i;
struct top_hash_entry *en; struct top_hash_entry *en;
u16 lenn = ntohs(ps->ospf_packet.length); u16 lenn = ntohs(ps->ospf_packet.length);

View file

@ -421,7 +421,6 @@ struct top_hash_entry *
lsa_install_new(struct ospf_lsa_header *lsa, void *body, struct ospf_area *oa) lsa_install_new(struct ospf_lsa_header *lsa, void *body, struct ospf_area *oa)
{ {
/* LSA can be temporarrily, but body must be mb_allocated. */ /* LSA can be temporarrily, but body must be mb_allocated. */
struct proto *p=&oa->po->proto;
int change=0; int change=0;
unsigned i; unsigned i;
struct top_hash_entry *en; struct top_hash_entry *en;

View file

@ -147,7 +147,6 @@ ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
{ {
sock *sk; sock *sk;
ip_addr to;
u16 len, age; u16 len, age;
struct ospf_lsupd_packet *pk; struct ospf_lsupd_packet *pk;
struct ospf_packet *op; struct ospf_packet *op;
@ -226,8 +225,6 @@ ospf_lsupd_send_list(struct ospf_neighbor *n, list * l)
struct ospf_packet *op; struct ospf_packet *op;
struct proto *p = &n->ifa->oa->po->proto; struct proto *p = &n->ifa->oa->po->proto;
void *pktpos; void *pktpos;
u8 ii;
u8 *jj = n->ifa->ip_sk->tbuf;
if (EMPTY_LIST(*l)) if (EMPTY_LIST(*l))
return; return;
@ -294,7 +291,6 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
struct ospf_area *oa; struct ospf_area *oa;
struct proto_ospf *po = ifa->proto; struct proto_ospf *po = ifa->proto;
struct proto *p = (struct proto *) po; struct proto *p = (struct proto *) po;
u16 length;
u8 i; u8 i;
int sendreq = 1; int sendreq = 1;

View file

@ -375,7 +375,7 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event)
void void
bdr_election(struct ospf_iface *ifa) bdr_election(struct ospf_iface *ifa)
{ {
struct ospf_neighbor *neigh,*ndr,*nbdr,me,*tmp; struct ospf_neighbor *neigh,*ndr,*nbdr,me;
u32 myid; u32 myid;
ip_addr ndrip, nbdrip; ip_addr ndrip, nbdrip;
int doadj; int doadj;
@ -570,7 +570,6 @@ rxmt_timer_hook(timer *timer)
{ {
struct ospf_neighbor *n = (struct ospf_neighbor *)timer->data; struct ospf_neighbor *n = (struct ospf_neighbor *)timer->data;
struct ospf_iface *ifa = n->ifa; struct ospf_iface *ifa = n->ifa;
struct proto *p = (struct proto *)(ifa->proto);
struct top_hash_entry *en; struct top_hash_entry *en;
DBG("%s: RXMT timer fired on interface %s for neigh: %I.\n", DBG("%s: RXMT timer fired on interface %s for neigh: %I.\n",

View file

@ -129,10 +129,8 @@ ospf_start(struct proto *p)
static void static void
ospf_dump(struct proto *p) ospf_dump(struct proto *p)
{ {
char areastr[20];
struct ospf_iface *ifa; struct ospf_iface *ifa;
struct ospf_neighbor *n; struct ospf_neighbor *n;
struct ospf_config *c = (void *) p->cf;
struct proto_ospf *po=(struct proto_ospf *)p; struct proto_ospf *po=(struct proto_ospf *)p;
struct ospf_area *oa; struct ospf_area *oa;
@ -165,8 +163,6 @@ ospf_init(struct proto_config *c)
struct proto *p = proto_new(c, sizeof(struct proto_ospf)); struct proto *p = proto_new(c, sizeof(struct proto_ospf));
struct proto_ospf *po=(struct proto_ospf *)p; struct proto_ospf *po=(struct proto_ospf *)p;
struct ospf_config *oc=(struct ospf_config *)c; struct ospf_config *oc=(struct ospf_config *)c;
struct ospf_area_config *ac;
struct ospf_iface_patt *patt;
p->import_control = ospf_import_control; p->import_control = ospf_import_control;
p->make_tmp_attrs = ospf_make_tmp_attrs; p->make_tmp_attrs = ospf_make_tmp_attrs;
@ -185,8 +181,6 @@ ospf_init(struct proto_config *c)
static int static int
ospf_rte_better(struct rte *new, struct rte *old) ospf_rte_better(struct rte *new, struct rte *old)
{ {
struct proto *p = new->attrs->proto;
if(new->u.ospf.metric1==LSINFINITY) return 0; if(new->u.ospf.metric1==LSINFINITY) return 0;
/* External paths are always longer that internal */ /* External paths are always longer that internal */
@ -288,7 +282,7 @@ void
area_disp(timer *timer) area_disp(timer *timer)
{ {
struct ospf_area *oa=timer->data; struct ospf_area *oa=timer->data;
struct top_hash_entry *en,*nxt; struct top_hash_entry *nxt;
struct proto_ospf *po=oa->po; struct proto_ospf *po=oa->po;
struct ospf_iface *ifa; struct ospf_iface *ifa;
@ -324,7 +318,6 @@ int
ospf_import_control(struct proto *p, rte **new, ea_list **attrs, struct linpool *pool) ospf_import_control(struct proto *p, rte **new, ea_list **attrs, struct linpool *pool)
{ {
rte *e=*new; rte *e=*new;
struct proto_ospf *po=(struct proto_ospf *)p;
if(p==e->attrs->proto) return -1; /* Reject our own routes */ if(p==e->attrs->proto) return -1; /* Reject our own routes */
*attrs = ospf_build_attrs(*attrs, pool, LSINFINITY, 10000, 0); *attrs = ospf_build_attrs(*attrs, pool, LSINFINITY, 10000, 0);
@ -360,8 +353,6 @@ ospf_shutdown(struct proto *p)
{ {
struct proto_ospf *po=(struct proto_ospf *)p; struct proto_ospf *po=(struct proto_ospf *)p;
struct ospf_iface *ifa; struct ospf_iface *ifa;
struct ospf_neighbor *n;
struct ospf_area *oa;
OSPF_TRACE(D_EVENTS, "Shutdown requested"); OSPF_TRACE(D_EVENTS, "Shutdown requested");
/* And send to all my neighbors 1WAY */ /* And send to all my neighbors 1WAY */
@ -372,7 +363,7 @@ ospf_shutdown(struct proto *p)
} }
void void
ospf_rt_notify(struct proto *p, net *n, rte *new, rte *old, ea_list *attrs) ospf_rt_notify(struct proto *p, net *n, rte *new, rte *old UNUSED, ea_list *attrs)
{ {
struct proto_ospf *po=(struct proto_ospf *)p; struct proto_ospf *po=(struct proto_ospf *)p;
@ -436,7 +427,7 @@ ospf_get_status(struct proto *p, byte *buf)
} }
static void static void
ospf_get_route_info(rte *rte, byte *buf, ea_list *attrs) ospf_get_route_info(rte *rte, byte *buf, ea_list *attrs UNUSED)
{ {
char met=' '; char met=' ';
char type=' '; char type=' ';
@ -851,13 +842,8 @@ ospf_sh(struct proto *p)
void void
ospf_sh_iface(struct proto *p, char *iff) ospf_sh_iface(struct proto *p, char *iff)
{ {
struct ospf_area *oa;
struct proto_ospf *po=(struct proto_ospf *)p; struct proto_ospf *po=(struct proto_ospf *)p;
struct ospf_iface *ifa=NULL,*f; struct ospf_iface *ifa=NULL,*f;
struct ospf_neighbor *n;
int ifano;
int nno;
int adjno;
if(p->proto_state != PS_UP) if(p->proto_state != PS_UP)
{ {

View file

@ -31,7 +31,6 @@ fill_ospf_pkt_hdr (struct ospf_iface *ifa, void *buf, u8 h_type)
void void
ospf_tx_authenticate (struct ospf_iface *ifa, struct ospf_packet *pkt) ospf_tx_authenticate (struct ospf_iface *ifa, struct ospf_packet *pkt)
{ {
int i;
pkt->autype = htons (ifa->autype); pkt->autype = htons (ifa->autype);
memcpy (pkt->authetication, ifa->aukey, 8); memcpy (pkt->authetication, ifa->aukey, 8);
return; return;
@ -86,8 +85,6 @@ ospf_rx_hook (sock *sk, int size)
struct ospf_packet *ps; struct ospf_packet *ps;
struct ospf_iface *ifa = (struct ospf_iface *) (sk->data); struct ospf_iface *ifa = (struct ospf_iface *) (sk->data);
struct proto *p = (struct proto *) (ifa->proto); struct proto *p = (struct proto *) (ifa->proto);
int i;
u8 *pu8;
if (ifa->stub) if (ifa->stub)
return (1); return (1);
@ -218,7 +215,7 @@ ospf_tx_hook (sock * sk)
} }
void void
ospf_err_hook (sock * sk, int err) ospf_err_hook (sock * sk, int err UNUSED)
{ {
struct ospf_iface *ifa; struct ospf_iface *ifa;
struct proto *p; struct proto *p;
@ -241,8 +238,6 @@ sk_send_to_agt (sock * sk, u16 len, struct ospf_iface *ifa, u8 state)
void void
sk_send_to_bdr (sock * sk, u16 len, struct ospf_iface *ifa) sk_send_to_bdr (sock * sk, u16 len, struct ospf_iface *ifa)
{ {
struct ospf_neighbor *n;
if (ipa_compare (ifa->drip, ipa_from_u32 (0)) != 0) if (ipa_compare (ifa->drip, ipa_from_u32 (0)) != 0)
sk_send_to (sk, len, ifa->drip, OSPF_PROTO); sk_send_to (sk, len, ifa->drip, OSPF_PROTO);
if (ipa_compare (ifa->bdrip, ipa_from_u32 (0)) != 0) if (ipa_compare (ifa->bdrip, ipa_from_u32 (0)) != 0)

View file

@ -46,14 +46,12 @@ init_efib(struct fib_node *fn)
void void
ospf_rt_spfa(struct ospf_area *oa) ospf_rt_spfa(struct ospf_area *oa)
{ {
struct top_hash_entry *en;
u32 i,*rts; u32 i,*rts;
struct ospf_lsa_rt *rt; struct ospf_lsa_rt *rt;
struct ospf_lsa_rt_link *rtl,*rr; struct ospf_lsa_rt_link *rtl,*rr;
struct fib *in=&oa->infib; struct fib *in=&oa->infib;
struct infib *nf; struct infib *nf;
struct fib_iterator fit; struct fib_iterator fit;
int age=0,flush=0;
struct proto *p=&oa->po->proto; struct proto *p=&oa->po->proto;
struct proto_ospf *po=oa->po; struct proto_ospf *po=oa->po;
ip_addr ip; ip_addr ip;
@ -280,7 +278,6 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */
struct proto *p=&po->proto; struct proto *p=&po->proto;
struct ospf_lsa_ext *le; struct ospf_lsa_ext *le;
struct ospf_lsa_ext_tos *lt; struct ospf_lsa_ext_tos *lt;
struct ospf_lsa_rt *rt;
int mlen; int mlen;
ip_addr ip,nnh; ip_addr ip,nnh;
struct iface *nnhi=NULL; struct iface *nnhi=NULL;
@ -527,7 +524,6 @@ noch:
nf->oldtag=nf->tag; nf->oldtag=nf->tag;
} }
} }
let:
FIB_ITERATE_END(nftmp); FIB_ITERATE_END(nftmp);
} }
@ -537,9 +533,8 @@ add_cand(list *l, struct top_hash_entry *en, struct top_hash_entry *par,
u16 dist, struct ospf_area *oa) u16 dist, struct ospf_area *oa)
{ {
node *prev,*n; node *prev,*n;
int flag=0,added=0; int added=0;
struct top_hash_entry *act; struct top_hash_entry *act;
struct proto *p=&oa->po->proto;
if(en==NULL) return; if(en==NULL) return;
if(en->lsa.age==LSA_MAXAGE) return; if(en->lsa.age==LSA_MAXAGE) return;

View file

@ -29,8 +29,6 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length, struct proto_ospf *p)
struct ospf_lsa_rt *rt; struct ospf_lsa_rt *rt;
struct ospf_lsa_rt_link *ln; struct ospf_lsa_rt_link *ln;
struct ospf_neighbor *neigh; struct ospf_neighbor *neigh;
struct top_hash_entry *old;
struct proto_ospf *po=(struct proto_ospf *)p;
DBG("%s: Originating RT_lsa body for area \"%I\".\n", po->proto.name, DBG("%s: Originating RT_lsa body for area \"%I\".\n", po->proto.name,
oa->areaid); oa->areaid);
@ -155,8 +153,6 @@ addifa_rtlsa(struct ospf_iface *ifa)
{ {
struct ospf_area *oa; struct ospf_area *oa;
struct proto_ospf *po=ifa->proto; struct proto_ospf *po=ifa->proto;
struct proto *p=&po->proto;
WALK_LIST(NODE oa,po->area_list) WALK_LIST(NODE oa,po->area_list)
{ {
@ -264,7 +260,6 @@ originate_net_lsa(struct ospf_iface *ifa)
struct proto_ospf *po=ifa->proto; struct proto_ospf *po=ifa->proto;
struct ospf_lsa_header lsa; struct ospf_lsa_header lsa;
u32 rtid=po->proto.cf->global->router_id; u32 rtid=po->proto.cf->global->router_id;
struct top_hash_entry *en;
struct proto *p=&po->proto; struct proto *p=&po->proto;
void *body; void *body;
@ -322,7 +317,6 @@ originate_ext_lsa_body(net *n, rte *e, struct proto_ospf *po, struct ea_list *at
struct proto *p=&po->proto; struct proto *p=&po->proto;
struct ospf_lsa_ext *ext; struct ospf_lsa_ext *ext;
struct ospf_lsa_ext_tos *et; struct ospf_lsa_ext_tos *et;
neighbor *nn;
u32 m1 = ea_get_int(attrs, EA_OSPF_METRIC1, LSINFINITY); u32 m1 = ea_get_int(attrs, EA_OSPF_METRIC1, LSINFINITY);
u32 m2 = ea_get_int(attrs, EA_OSPF_METRIC2, 10000); u32 m2 = ea_get_int(attrs, EA_OSPF_METRIC2, 10000);
u32 tag = ea_get_int(attrs, EA_OSPF_TAG, 0); u32 tag = ea_get_int(attrs, EA_OSPF_TAG, 0);
@ -673,7 +667,6 @@ can_flush_lsa(struct ospf_area *oa)
{ {
struct ospf_iface *ifa; struct ospf_iface *ifa;
struct ospf_neighbor *n; struct ospf_neighbor *n;
struct proto_ospf *po=oa->po;
WALK_LIST(ifa, iface_list) WALK_LIST(ifa, iface_list)
{ {