diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-26 18:42:59 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-26 18:42:59 +0000 |
commit | 93ebd039aab8b830e0887dd59360f2ba8de75c07 (patch) | |
tree | 882428538d855a48e3b9aea35d571b1735d298cf /udp.c | |
parent | af0f1d0b0a47be5c19b89e1769810f4c69da5941 (diff) | |
download | slirp-93ebd039aab8b830e0887dd59360f2ba8de75c07.zip slirp-93ebd039aab8b830e0887dd59360f2ba8de75c07.tar.gz slirp-93ebd039aab8b830e0887dd59360f2ba8de75c07.tar.bz2 |
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 'udp.c')
-rw-r--r-- | udp.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -45,7 +45,9 @@ #include <slirp.h> #include "ip_icmp.h" +#ifdef LOG_ENABLED struct udpstat udpstat; +#endif struct socket udb; @@ -83,7 +85,7 @@ int 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, @@ -110,7 +112,7 @@ int 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); @@ -137,7 +139,7 @@ int iphlen; * if (uh->uh_sum) { */ if (cksum(m, len + sizeof(struct ip))) { - udpstat.udps_badsum++; + STAT(udpstat.udps_badsum++); goto bad; } } @@ -178,7 +180,7 @@ int 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 sockaddr_in *saddr, ((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); |