]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Tracing.
authorOndrej Filip <feela@network.cz>
Tue, 6 Jun 2000 02:34:57 +0000 (02:34 +0000)
committerOndrej Filip <feela@network.cz>
Tue, 6 Jun 2000 02:34:57 +0000 (02:34 +0000)
proto/ospf/dbdes.c
proto/ospf/hello.c
proto/ospf/iface.c
proto/ospf/neighbor.c
proto/ospf/rt.c

index 4b73733310903851b524207825db33eec9ae7965..43b5805991fb3d2d7248e174f68d0cce505e84c3 100644 (file)
@@ -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->mtu<size)
   {
-    debug("%s: Received dbdes larger than MTU from %I!\n", p->name, 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
index 100dec581ce5531e8c8dd84150f45228d20b9737..8117afe1eb2da64a87e33cb8b30faa53920c3808 100644 (file)
@@ -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
index 7658f436c74c454809f4b3d5004f8eae485f1c96..70ad7462f097bf18bcac06052361df09a9c04eeb 100644 (file)
@@ -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 */
     }
   }
index 72930cc34b01df72bf33123d4b48a90366759aaa..8e59f0c6e30d19b67f46ac7312f1c435f936761c 100644 (file)
@@ -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) && (oldstate<NEIGHBOR_2WAY))
       ospf_int_sm(ifa, ISM_NEICH);
@@ -278,7 +278,7 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event)
       break;
     case INM_SEQMIS:
     case INM_BADLSREQ:
-      debug("%s: Bad LS req!\n", p->name);
+      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
index 32aeed2cffe5f04c5f54ab3106dbd26a59a55c62..726fe04341101b743a34a81b076c8bff4323e3e6 100644 (file)
@@ -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)
   {