summary refs log tree commit diff stats
path: root/slirp/udp.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-26 18:42:59 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-26 18:42:59 +0000
commit31a60e22752d3daaa248ca10930f3cf4bc5f02e8 (patch)
tree18f5bd36118d98e2004fc0e5af866a280667278c /slirp/udp.c
parent7d294b61edc6bd1be15739a11dce1414080dbb9b (diff)
downloadfocaccia-qemu-31a60e22752d3daaa248ca10930f3cf4bc5f02e8.tar.gz
focaccia-qemu-31a60e22752d3daaa248ca10930f3cf4bc5f02e8.zip
Make Slirp statistics gathering and output conditional to LOG_ENABLED
Add 'info slirp' command to monitor to display statistics
Disable Slirp debugging code by default


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3451 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'slirp/udp.c')
-rw-r--r--slirp/udp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/slirp/udp.c b/slirp/udp.c
index 44900ff144..8510380949 100644
--- a/slirp/udp.c
+++ b/slirp/udp.c
@@ -45,7 +45,9 @@
 #include <slirp.h>
 #include "ip_icmp.h"
 
+#ifdef LOG_ENABLED
 struct udpstat udpstat;
+#endif
 
 struct socket udb;
 
@@ -86,7 +88,7 @@ udp_input(m, iphlen)
 	DEBUG_ARG("m = %lx", (long)m);
 	DEBUG_ARG("iphlen = %d", iphlen);
 
-	udpstat.udps_ipackets++;
+	STAT(udpstat.udps_ipackets++);
 
 	/*
 	 * Strip IP options, if any; should skip this,
@@ -113,7 +115,7 @@ udp_input(m, iphlen)
 
 	if (ip->ip_len != len) {
 		if (len > ip->ip_len) {
-			udpstat.udps_badlen++;
+			STAT(udpstat.udps_badlen++);
 			goto bad;
 		}
 		m_adj(m, len - ip->ip_len);
@@ -140,7 +142,7 @@ udp_input(m, iphlen)
 	   * if (uh->uh_sum) {
 	   */
 	  if(cksum(m, len + sizeof(struct ip))) {
-	    udpstat.udps_badsum++;
+	    STAT(udpstat.udps_badsum++);
 	    goto bad;
 	  }
 	}
@@ -181,7 +183,7 @@ udp_input(m, iphlen)
 		if (tmp == &udb) {
 		  so = NULL;
 		} else {
-		  udpstat.udpps_pcbcachemiss++;
+		  STAT(udpstat.udpps_pcbcachemiss++);
 		  udp_last_so = so;
 		}
 	}
@@ -299,7 +301,7 @@ int udp_output2(struct socket *so, struct mbuf *m,
 	((struct ip *)ui)->ip_ttl = ip_defttl;
 	((struct ip *)ui)->ip_tos = iptos;
 
-	udpstat.udps_opackets++;
+	STAT(udpstat.udps_opackets++);
 
 	error = ip_output(so, m);