From abcbfd0400eeb514c63376b50d3948581c20ca4c Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Tue, 6 Jun 2000 02:34:57 +0000 Subject: [PATCH] Tracing. --- proto/ospf/dbdes.c | 18 +++++++++--------- proto/ospf/hello.c | 6 +++--- proto/ospf/iface.c | 16 ++++++++-------- proto/ospf/neighbor.c | 12 ++++++------ proto/ospf/rt.c | 5 ++--- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 4b737333..43b58059 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -36,7 +36,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n) op->length=htons(length); ospf_pkt_finalize(ifa, op); sk_send_to(ifa->ip_sk,length, n->ip, OSPF_PROTO); - debug("%s: DB_DES (I) sent to %I via %s.\n", p->name, n->ip, + OSPF_TRACE(D_PACKETS, "DB_DES (I) sent to %I via %s.", n->ip, ifa->iface->name); break; @@ -117,7 +117,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n) } sk_send_to(ifa->ip_sk,length, n->ip, OSPF_PROTO); - debug("%s: DB_DES (M) sent to %I via %s.\n", p->name, n->ip, + OSPF_TRACE(D_PACKETS, "DB_DES (M) sent to %I via %s.", n->ip, ifa->iface->name); if(n->myimms.bit.ms) tm_start(n->rxmt_timer,ifa->rxmtint); else @@ -206,18 +206,18 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, if((n=find_neigh(ifa, nrid))==NULL) { - debug("%s: Received dbdes from unknown neigbor! %I\n", p->name, + OSPF_TRACE(D_PACKETS, "Received dbdes from unknown neigbor! %I.", nrid); return ; } if(ifa->iface->mtuname, n->ip); + OSPF_TRACE(D_PACKETS, "Received dbdes larger than MTU from %I!", n->ip); return ; } - debug("%s: Received dbdes from %I via %s.\n", p->name, n->ip, + OSPF_TRACE(D_PACKETS, "Received dbdes from %I via %s.", n->ip, ifa->iface->name); ospf_neigh_sm(n, INM_HELLOREC); @@ -242,7 +242,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, n->options=ps->options; n->myimms.bit.ms=0; n->imms.byte=ps->imms.byte; - debug("%s: I'm slave to %I. \n", p->name, n->ip); + OSPF_TRACE(D_PACKETS, "I'm slave to %I.", n->ip); ospf_neigh_sm(n, INM_NEGDONE); tm_stop(n->rxmt_timer); ospf_dbdes_tx(n); @@ -257,7 +257,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, n->options=ps->options; n->ddr=ntohl(ps->ddseq)-1; n->imms.byte=ps->imms.byte; - debug("%s: I'm master to %I. \n", p->name, nrid); + OSPF_TRACE(D_PACKETS, "I'm master to %I.", nrid); ospf_neigh_sm(n, INM_NEGDONE); } else @@ -273,7 +273,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, (ntohl(ps->ddseq)==n->ddr)) { /* Duplicate packet */ - debug("%s: Received duplicate dbdes from %I!\n", p->name, n->ip); + OSPF_TRACE(D_PACKETS, "Received duplicate dbdes from %I.", n->ip); if(n->imms.bit.ms==0) { ospf_dbdes_tx(n); @@ -347,7 +347,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, if((ps->imms.byte==n->imms.byte) && (ps->options=n->options) && (ps->ddseq==n->dds)) /* Only duplicate are accepted */ { - debug("%s: Received duplicate dbdes from %I!\n", p->name, n->ip); + OSPF_TRACE(D_PACKETS, "Received duplicate dbdes from %I.",n->ip); return; } else diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c index 100dec58..8117afe1 100644 --- a/proto/ospf/hello.c +++ b/proto/ospf/hello.c @@ -58,7 +58,7 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p, nrid=ntohl(((struct ospf_packet *)ps)->routerid); - debug("%s: Received hello from %I via %s\n",p->name,faddr,ifa->iface->name); + OSPF_TRACE(D_PACKETS, "Received hello from %I via %s",faddr,ifa->iface->name); if((unsigned)ipa_mklen(ipa_ntoh(ps->netmask))!=ifa->iface->addr->pxlen) { @@ -87,7 +87,7 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p, if((n=find_neigh(ifa, nrid))==NULL) { - debug("%s: New neighbor found: %I on %s.", p->name,faddr, + OSPF_TRACE(D_EVENTS, "New neighbor found: %I on %s.", faddr, ifa->iface->name); n=mb_allocz(p->pool, sizeof(struct ospf_neighbor)); add_tail(&ifa->neigh_list, NODE n); @@ -255,7 +255,7 @@ hello_timer_hook(timer *timer) } sk_send_to_agt(ifa->ip_sk, length, ifa, NEIGHBOR_DOWN); } - debug("%s: Hello sent via %s\n",p->name,ifa->iface->name); + OSPF_TRACE(D_PACKETS, "Hello sent via %s",ifa->iface->name); } void diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 7658f436..70ad7462 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -25,8 +25,8 @@ iface_chstate(struct ospf_iface *ifa, u8 state) if(ifa->state!=state) { - debug("%s: Changing state of iface: %s from \"%s\" into \"%s\".\n", - p->name, ifa->iface->name, ospf_is[ifa->state], ospf_is[state]); + OSPF_TRACE(D_EVENTS, "Changing state of iface: %s from \"%s\" into \"%s\".", + ifa->iface->name, ospf_is[ifa->state], ospf_is[state]); oldstate=ifa->state; ifa->state=state; if(ifa->iface->flags & IF_MULTICAST) @@ -87,7 +87,7 @@ downint(struct ospf_iface *ifa) WALK_LIST_DELSAFE(n,nx,ifa->neigh_list) { - debug("%s: Removing neighbor %I\n", p->name, n->ip); + OSPF_TRACE(D_EVENTS, "%s: Removing neighbor %I", n->ip); ospf_neigh_remove(n); } rem_node(NODE ifa); @@ -124,8 +124,8 @@ ospf_int_sm(struct ospf_iface *ifa, int event) struct proto_ospf *po=ifa->proto; struct ospf_area *oa=ifa->oa; - debug("%s: SM on iface %s. Event is \"%s\".\n", - p->name, ifa->iface->name, ospf_ism[event]); + OSPF_TRACE(D_EVENTS, "SM on iface %s. Event is \"%s\".", + ifa->iface->name, ospf_ism[event]); switch(event) { @@ -299,7 +299,6 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface) if(flags & IF_CHANGE_UP) { - debug("%s: using interface %s.\n", p->name, iface->name); WALK_LIST(ac, c->area_list) { if(ip=(struct ospf_iface_patt *) @@ -308,6 +307,7 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface) if(ip) { + OSPF_TRACE(D_EVENTS, "Using interface %s.", iface->name); lock = olock_new( p->pool ); lock->addr = AllSPFRouters; lock->type = OBJLOCK_UDP; @@ -323,7 +323,7 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface) { if((ifa=find_iface((struct proto_ospf *)p, iface))!=NULL) { - debug("%s: killing interface %s.\n", p->name, iface->name); + OSPF_TRACE(D_EVENTS, "Killing interface %s.", iface->name); ospf_int_sm(ifa, ISM_DOWN); } } @@ -332,7 +332,7 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface) { if((ifa=find_iface((struct proto_ospf *)p, iface))!=NULL) { - debug("%s: changing MTU on interface %s.\n", p->name, iface->name); + OSPF_TRACE(D_EVENTS, "Changing MTU on interface %s.", iface->name); /* FIXME: change MTU */ } } diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index 72930cc3..8e59f0c6 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -37,8 +37,8 @@ neigh_chstate(struct ospf_neighbor *n, u8 state) n->state=state; - debug("%s: Neighbor %I changes state from \"%s\" to \"%s\".\n", - p->name, n->ip, ospf_ns[oldstate], ospf_ns[state]); + OSPF_TRACE( D_EVENTS, "Neighbor %I changes state from \"%s\" to \"%s\".", + n->ip, ospf_ns[oldstate], ospf_ns[state]); if((state==NEIGHBOR_2WAY) && (oldstatename); + OSPF_TRACE(D_EVENTS, "Bad LS req!"); if(n->state>=NEIGHBOR_EXCHANGE) { neigh_chstate(n,NEIGHBOR_EXSTART); @@ -439,8 +439,8 @@ neighbor_timer_hook(timer *timer) n=(struct ospf_neighbor *)timer->data; ifa=n->ifa; p=(struct proto *)(ifa->proto); - debug("%s: Inactivity timer fired on interface %s for neighbor %I.\n", - p->name, ifa->iface->name, n->ip); + OSPF_TRACE(D_EVENTS,"Inactivity timer fired on interface %s for neighbor %I.", + ifa->iface->name, n->ip); ospf_neigh_remove(n); } @@ -484,7 +484,7 @@ ospf_neigh_remove(struct ospf_neighbor *n) } rem_node(NODE n); mb_free(n); - debug("%s: Deleting neigbor.\n", p->name); + OSPF_TRACE(D_EVENTS, "Deleting neigbor."); } void diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 32aeed2c..726fe043 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -45,7 +45,7 @@ ospf_rt_spfa(struct ospf_area *oa) ip_addr ip; struct ospf_lsa_net *ln; - debug("%s: Starting routing table calculation for area %I\n",p->name, + OSPF_TRACE(D_EVENTS, "Starting routing table calculation for area %I", oa->areaid); if(oa->rt==NULL) return; @@ -266,8 +266,7 @@ ospf_ext_spfa(struct proto_ospf *po) /* FIXME looking into inter-area */ u32 tag; neighbor *nn; - debug("%s: Starting routing table calculation for external routes\n", - p->name); + OSPF_TRACE(D_EVENTS,"Starting routing table calculation for ext routes"); FIB_WALK(ef,nftmp) {