]> git.proxmox.com Git - qemu.git/blobdiff - slirp/ip_icmp.c
Make Slirp statistics gathering and output conditional to LOG_ENABLED
[qemu.git] / slirp / ip_icmp.c
index ae5a3211852ff64e9c9c51e98e3b10a72e68db58..4cf14c8e3aff9ea65160d24ef5fe0f9b0a03ac31 100644 (file)
@@ -37,7 +37,9 @@
 #include "slirp.h"
 #include "ip_icmp.h"
 
+#ifdef LOG_ENABLED
 struct icmpstat icmpstat;
+#endif
 
 /* The message sent when emulating PING */
 /* Be nice and tell them it's just a psuedo-ping packet */
@@ -83,14 +85,14 @@ icmp_input(m, hlen)
   DEBUG_ARG("m = %lx", (long )m);
   DEBUG_ARG("m_len = %d", m->m_len);
 
-  icmpstat.icps_received++;
+  STAT(icmpstat.icps_received++);
 
   /*
    * Locate icmp structure in mbuf, and check
    * that its not corrupted and of at least minimum length.
    */
   if (icmplen < ICMP_MINLEN) {          /* min 8 bytes payload */
-    icmpstat.icps_tooshort++;
+    STAT(icmpstat.icps_tooshort++);
   freeit:
     m_freem(m);
     goto end_error;
@@ -100,7 +102,7 @@ icmp_input(m, hlen)
   m->m_data += hlen;
   icp = mtod(m, struct icmp *);
   if (cksum(m, icmplen)) {
-    icmpstat.icps_checksum++;
+    STAT(icmpstat.icps_checksum++);
     goto freeit;
   }
   m->m_len += hlen;
@@ -170,12 +172,12 @@ icmp_input(m, hlen)
   case ICMP_TSTAMP:
   case ICMP_MASKREQ:
   case ICMP_REDIRECT:
-    icmpstat.icps_notsupp++;
+    STAT(icmpstat.icps_notsupp++);
     m_freem(m);
     break;
 
   default:
-    icmpstat.icps_badtype++;
+    STAT(icmpstat.icps_badtype++);
     m_freem(m);
   } /* swith */
 
@@ -314,7 +316,7 @@ icmp_error(msrc, type, code, minsize, message)
 
   (void ) ip_output((struct socket *)NULL, m);
 
-  icmpstat.icps_reflect++;
+  STAT(icmpstat.icps_reflect++);
 
 end_error:
   return;
@@ -371,5 +373,5 @@ icmp_reflect(m)
 
   (void ) ip_output((struct socket *)NULL, m);
 
-  icmpstat.icps_reflect++;
+  STAT(icmpstat.icps_reflect++);
 }