Statistics
| Branch: | Revision:

root / slirp / debug.c @ 6dbe553f

History | View | Annotate | Download (10.6 kB)

1 f0cbd3ec bellard
/*
2 f0cbd3ec bellard
 * Copyright (c) 1995 Danny Gasparovski.
3 f0cbd3ec bellard
 * Portions copyright (c) 2000 Kelly Price.
4 5fafdf24 ths
 *
5 5fafdf24 ths
 * Please read the file COPYRIGHT for the
6 f0cbd3ec bellard
 * terms and conditions of the copyright.
7 f0cbd3ec bellard
 */
8 f0cbd3ec bellard
9 f0cbd3ec bellard
#include <slirp.h>
10 f0cbd3ec bellard
11 f0cbd3ec bellard
FILE *dfd = NULL;
12 f0cbd3ec bellard
#ifdef DEBUG
13 f0cbd3ec bellard
int dostats = 1;
14 f0cbd3ec bellard
#else
15 f0cbd3ec bellard
int dostats = 0;
16 f0cbd3ec bellard
#endif
17 f0cbd3ec bellard
int slirp_debug = 0;
18 f0cbd3ec bellard
19 5fafdf24 ths
/* Carry over one item from main.c so that the tty's restored.
20 f0cbd3ec bellard
 * Only done when the tty being used is /dev/tty --RedWolf */
21 31a60e22 blueswir1
#ifndef CONFIG_QEMU
22 f0cbd3ec bellard
extern struct termios slirp_tty_settings;
23 f0cbd3ec bellard
extern int slirp_tty_restore;
24 f0cbd3ec bellard
25 f0cbd3ec bellard
26 f0cbd3ec bellard
void
27 f0cbd3ec bellard
debug_init(file, dbg)
28 f0cbd3ec bellard
        char *file;
29 f0cbd3ec bellard
        int dbg;
30 f0cbd3ec bellard
{
31 f0cbd3ec bellard
        /* Close the old debugging file */
32 f0cbd3ec bellard
        if (dfd)
33 f0cbd3ec bellard
           fclose(dfd);
34 5fafdf24 ths
35 f0cbd3ec bellard
        dfd = fopen(file,"w");
36 f0cbd3ec bellard
        if (dfd != NULL) {
37 f0cbd3ec bellard
#if 0
38 f0cbd3ec bellard
                fprintf(dfd,"Slirp %s - Debugging Started.\n", SLIRP_VERSION);
39 f0cbd3ec bellard
#endif
40 f0cbd3ec bellard
                fprintf(dfd,"Debugging Started level %i.\r\n",dbg);
41 f0cbd3ec bellard
                fflush(dfd);
42 f0cbd3ec bellard
                slirp_debug = dbg;
43 f0cbd3ec bellard
        } else {
44 f0cbd3ec bellard
                lprint("Error: Debugging file \"%s\" could not be opened: %s\r\n",
45 f0cbd3ec bellard
                        file, strerror(errno));
46 f0cbd3ec bellard
        }
47 f0cbd3ec bellard
}
48 f0cbd3ec bellard
49 f0cbd3ec bellard
/*
50 f0cbd3ec bellard
 * Dump a packet in the same format as tcpdump -x
51 f0cbd3ec bellard
 */
52 f0cbd3ec bellard
#ifdef DEBUG
53 f0cbd3ec bellard
void
54 f0cbd3ec bellard
dump_packet(dat, n)
55 f0cbd3ec bellard
        void *dat;
56 f0cbd3ec bellard
        int n;
57 f0cbd3ec bellard
{
58 f0cbd3ec bellard
        u_char *pptr = (u_char *)dat;
59 f0cbd3ec bellard
        int j,k;
60 5fafdf24 ths
61 f0cbd3ec bellard
        n /= 16;
62 f0cbd3ec bellard
        n++;
63 f0cbd3ec bellard
        DEBUG_MISC((dfd, "PACKET DUMPED: \n"));
64 f0cbd3ec bellard
        for(j = 0; j < n; j++) {
65 f0cbd3ec bellard
                for(k = 0; k < 6; k++)
66 f0cbd3ec bellard
                        DEBUG_MISC((dfd, "%02x ", *pptr++));
67 f0cbd3ec bellard
                DEBUG_MISC((dfd, "\n"));
68 f0cbd3ec bellard
                fflush(dfd);
69 f0cbd3ec bellard
        }
70 f0cbd3ec bellard
}
71 f0cbd3ec bellard
#endif
72 31a60e22 blueswir1
#endif
73 f0cbd3ec bellard
74 31a60e22 blueswir1
#ifdef LOG_ENABLED
75 f0cbd3ec bellard
#if 0
76 f0cbd3ec bellard
/*
77 f0cbd3ec bellard
 * Statistic routines
78 5fafdf24 ths
 *
79 f0cbd3ec bellard
 * These will print statistics to the screen, the debug file (dfd), or
80 f0cbd3ec bellard
 * a buffer, depending on "type", so that the stats can be sent over
81 f0cbd3ec bellard
 * the link as well.
82 f0cbd3ec bellard
 */
83 f0cbd3ec bellard

84 31a60e22 blueswir1
static void
85 f0cbd3ec bellard
ttystats(ttyp)
86 f0cbd3ec bellard
        struct ttys *ttyp;
87 f0cbd3ec bellard
{
88 f0cbd3ec bellard
        struct slirp_ifstats *is = &ttyp->ifstats;
89 f0cbd3ec bellard
        char buff[512];
90 5fafdf24 ths

91 f0cbd3ec bellard
        lprint(" \r\n");
92 5fafdf24 ths

93 9634d903 blueswir1
        if (IF_COMP & IF_COMPRESS)
94 f0cbd3ec bellard
           strcpy(buff, "on");
95 9634d903 blueswir1
        else if (IF_COMP & IF_NOCOMPRESS)
96 f0cbd3ec bellard
           strcpy(buff, "off");
97 f0cbd3ec bellard
        else
98 f0cbd3ec bellard
           strcpy(buff, "off (for now)");
99 f0cbd3ec bellard
        lprint("Unit %d:\r\n", ttyp->unit);
100 f0cbd3ec bellard
        lprint("  using %s encapsulation (VJ compression is %s)\r\n", (
101 f0cbd3ec bellard
#ifdef USE_PPP
102 f0cbd3ec bellard
               ttyp->proto==PROTO_PPP?"PPP":
103 f0cbd3ec bellard
#endif
104 f0cbd3ec bellard
               "SLIP"), buff);
105 f0cbd3ec bellard
        lprint("  %d baudrate\r\n", ttyp->baud);
106 f0cbd3ec bellard
        lprint("  interface is %s\r\n", ttyp->up?"up":"down");
107 f0cbd3ec bellard
        lprint("  using fd %d, guardian pid is %d\r\n", ttyp->fd, ttyp->pid);
108 f0cbd3ec bellard
#ifndef FULL_BOLT
109 f0cbd3ec bellard
        lprint("  towrite is %d bytes\r\n", ttyp->towrite);
110 f0cbd3ec bellard
#endif
111 f0cbd3ec bellard
        if (ttyp->zeros)
112 f0cbd3ec bellard
           lprint("  %d zeros have been typed\r\n", ttyp->zeros);
113 f0cbd3ec bellard
        else if (ttyp->ones)
114 f0cbd3ec bellard
           lprint("  %d ones have been typed\r\n", ttyp->ones);
115 f0cbd3ec bellard
        lprint("Interface stats:\r\n");
116 f0cbd3ec bellard
        lprint("  %6d output packets sent (%d bytes)\r\n", is->out_pkts, is->out_bytes);
117 f0cbd3ec bellard
        lprint("  %6d output packets dropped (%d bytes)\r\n", is->out_errpkts, is->out_errbytes);
118 f0cbd3ec bellard
        lprint("  %6d input packets received (%d bytes)\r\n", is->in_pkts, is->in_bytes);
119 f0cbd3ec bellard
        lprint("  %6d input packets dropped (%d bytes)\r\n", is->in_errpkts, is->in_errbytes);
120 f0cbd3ec bellard
        lprint("  %6d bad input packets\r\n", is->in_mbad);
121 f0cbd3ec bellard
}
122 f0cbd3ec bellard
123 31a60e22 blueswir1
static void
124 31a60e22 blueswir1
allttystats(void)
125 f0cbd3ec bellard
{
126 f0cbd3ec bellard
        struct ttys *ttyp;
127 5fafdf24 ths
128 f0cbd3ec bellard
        for (ttyp = ttys; ttyp; ttyp = ttyp->next)
129 f0cbd3ec bellard
           ttystats(ttyp);
130 f0cbd3ec bellard
}
131 f0cbd3ec bellard
#endif
132 f0cbd3ec bellard
133 31a60e22 blueswir1
static void
134 31a60e22 blueswir1
ipstats(void)
135 f0cbd3ec bellard
{
136 5fafdf24 ths
        lprint(" \r\n");
137 f0cbd3ec bellard
138 f0cbd3ec bellard
        lprint("IP stats:\r\n");
139 f0cbd3ec bellard
        lprint("  %6d total packets received (%d were unaligned)\r\n",
140 f0cbd3ec bellard
                        ipstat.ips_total, ipstat.ips_unaligned);
141 f0cbd3ec bellard
        lprint("  %6d with incorrect version\r\n", ipstat.ips_badvers);
142 f0cbd3ec bellard
        lprint("  %6d with bad header checksum\r\n", ipstat.ips_badsum);
143 f0cbd3ec bellard
        lprint("  %6d with length too short (len < sizeof(iphdr))\r\n", ipstat.ips_tooshort);
144 f0cbd3ec bellard
        lprint("  %6d with length too small (len < ip->len)\r\n", ipstat.ips_toosmall);
145 f0cbd3ec bellard
        lprint("  %6d with bad header length\r\n", ipstat.ips_badhlen);
146 f0cbd3ec bellard
        lprint("  %6d with bad packet length\r\n", ipstat.ips_badlen);
147 f0cbd3ec bellard
        lprint("  %6d fragments received\r\n", ipstat.ips_fragments);
148 f0cbd3ec bellard
        lprint("  %6d fragments dropped\r\n", ipstat.ips_fragdropped);
149 f0cbd3ec bellard
        lprint("  %6d fragments timed out\r\n", ipstat.ips_fragtimeout);
150 f0cbd3ec bellard
        lprint("  %6d packets reassembled ok\r\n", ipstat.ips_reassembled);
151 f0cbd3ec bellard
        lprint("  %6d outgoing packets fragmented\r\n", ipstat.ips_fragmented);
152 f0cbd3ec bellard
        lprint("  %6d total outgoing fragments\r\n", ipstat.ips_ofragments);
153 f0cbd3ec bellard
        lprint("  %6d with bad protocol field\r\n", ipstat.ips_noproto);
154 f0cbd3ec bellard
        lprint("  %6d total packets delivered\r\n", ipstat.ips_delivered);
155 f0cbd3ec bellard
}
156 f0cbd3ec bellard
157 31a60e22 blueswir1
#ifndef CONFIG_QEMU
158 31a60e22 blueswir1
static void
159 31a60e22 blueswir1
vjstats(void)
160 f0cbd3ec bellard
{
161 f0cbd3ec bellard
        lprint(" \r\n");
162 5fafdf24 ths
163 f0cbd3ec bellard
        lprint("VJ compression stats:\r\n");
164 5fafdf24 ths
165 f0cbd3ec bellard
        lprint("  %6d outbound packets (%d compressed)\r\n",
166 f0cbd3ec bellard
               comp_s.sls_packets, comp_s.sls_compressed);
167 f0cbd3ec bellard
        lprint("  %6d searches for connection stats (%d misses)\r\n",
168 f0cbd3ec bellard
               comp_s.sls_searches, comp_s.sls_misses);
169 f0cbd3ec bellard
        lprint("  %6d inbound uncompressed packets\r\n", comp_s.sls_uncompressedin);
170 f0cbd3ec bellard
        lprint("  %6d inbound compressed packets\r\n", comp_s.sls_compressedin);
171 f0cbd3ec bellard
        lprint("  %6d inbound unknown type packets\r\n", comp_s.sls_errorin);
172 f0cbd3ec bellard
        lprint("  %6d inbound packets tossed due to error\r\n", comp_s.sls_tossed);
173 f0cbd3ec bellard
}
174 f0cbd3ec bellard
#endif
175 f0cbd3ec bellard
176 31a60e22 blueswir1
static void
177 31a60e22 blueswir1
tcpstats(void)
178 f0cbd3ec bellard
{
179 f0cbd3ec bellard
        lprint(" \r\n");
180 f0cbd3ec bellard
181 f0cbd3ec bellard
        lprint("TCP stats:\r\n");
182 5fafdf24 ths
183 f0cbd3ec bellard
        lprint("  %6d packets sent\r\n", tcpstat.tcps_sndtotal);
184 f0cbd3ec bellard
        lprint("          %6d data packets (%d bytes)\r\n",
185 f0cbd3ec bellard
                        tcpstat.tcps_sndpack, tcpstat.tcps_sndbyte);
186 f0cbd3ec bellard
        lprint("          %6d data packets retransmitted (%d bytes)\r\n",
187 f0cbd3ec bellard
                        tcpstat.tcps_sndrexmitpack, tcpstat.tcps_sndrexmitbyte);
188 f0cbd3ec bellard
        lprint("          %6d ack-only packets (%d delayed)\r\n",
189 f0cbd3ec bellard
                        tcpstat.tcps_sndacks, tcpstat.tcps_delack);
190 f0cbd3ec bellard
        lprint("          %6d URG only packets\r\n", tcpstat.tcps_sndurg);
191 f0cbd3ec bellard
        lprint("          %6d window probe packets\r\n", tcpstat.tcps_sndprobe);
192 f0cbd3ec bellard
        lprint("          %6d window update packets\r\n", tcpstat.tcps_sndwinup);
193 f0cbd3ec bellard
        lprint("          %6d control (SYN/FIN/RST) packets\r\n", tcpstat.tcps_sndctrl);
194 f0cbd3ec bellard
        lprint("          %6d times tcp_output did nothing\r\n", tcpstat.tcps_didnuttin);
195 5fafdf24 ths
196 3b46e624 ths
        lprint("  %6d packets received\r\n", tcpstat.tcps_rcvtotal);
197 f0cbd3ec bellard
        lprint("          %6d acks (for %d bytes)\r\n",
198 f0cbd3ec bellard
                        tcpstat.tcps_rcvackpack, tcpstat.tcps_rcvackbyte);
199 f0cbd3ec bellard
        lprint("          %6d duplicate acks\r\n", tcpstat.tcps_rcvdupack);
200 f0cbd3ec bellard
        lprint("          %6d acks for unsent data\r\n", tcpstat.tcps_rcvacktoomuch);
201 f0cbd3ec bellard
        lprint("          %6d packets received in sequence (%d bytes)\r\n",
202 f0cbd3ec bellard
                        tcpstat.tcps_rcvpack, tcpstat.tcps_rcvbyte);
203 f0cbd3ec bellard
        lprint("          %6d completely duplicate packets (%d bytes)\r\n",
204 f0cbd3ec bellard
                        tcpstat.tcps_rcvduppack, tcpstat.tcps_rcvdupbyte);
205 5fafdf24 ths
206 f0cbd3ec bellard
        lprint("          %6d packets with some duplicate data (%d bytes duped)\r\n",
207 f0cbd3ec bellard
                        tcpstat.tcps_rcvpartduppack, tcpstat.tcps_rcvpartdupbyte);
208 f0cbd3ec bellard
        lprint("          %6d out-of-order packets (%d bytes)\r\n",
209 f0cbd3ec bellard
                        tcpstat.tcps_rcvoopack, tcpstat.tcps_rcvoobyte);
210 f0cbd3ec bellard
        lprint("          %6d packets of data after window (%d bytes)\r\n",
211 f0cbd3ec bellard
                        tcpstat.tcps_rcvpackafterwin, tcpstat.tcps_rcvbyteafterwin);
212 f0cbd3ec bellard
        lprint("          %6d window probes\r\n", tcpstat.tcps_rcvwinprobe);
213 f0cbd3ec bellard
        lprint("          %6d window update packets\r\n", tcpstat.tcps_rcvwinupd);
214 f0cbd3ec bellard
        lprint("          %6d packets received after close\r\n", tcpstat.tcps_rcvafterclose);
215 f0cbd3ec bellard
        lprint("          %6d discarded for bad checksums\r\n", tcpstat.tcps_rcvbadsum);
216 f0cbd3ec bellard
        lprint("          %6d discarded for bad header offset fields\r\n",
217 f0cbd3ec bellard
                        tcpstat.tcps_rcvbadoff);
218 5fafdf24 ths
219 f0cbd3ec bellard
        lprint("  %6d connection requests\r\n", tcpstat.tcps_connattempt);
220 f0cbd3ec bellard
        lprint("  %6d connection accepts\r\n", tcpstat.tcps_accepts);
221 f0cbd3ec bellard
        lprint("  %6d connections established (including accepts)\r\n", tcpstat.tcps_connects);
222 f0cbd3ec bellard
        lprint("  %6d connections closed (including %d drop)\r\n",
223 f0cbd3ec bellard
                        tcpstat.tcps_closed, tcpstat.tcps_drops);
224 f0cbd3ec bellard
        lprint("  %6d embryonic connections dropped\r\n", tcpstat.tcps_conndrops);
225 f0cbd3ec bellard
        lprint("  %6d segments we tried to get rtt (%d succeeded)\r\n",
226 f0cbd3ec bellard
                        tcpstat.tcps_segstimed, tcpstat.tcps_rttupdated);
227 f0cbd3ec bellard
        lprint("  %6d retransmit timeouts\r\n", tcpstat.tcps_rexmttimeo);
228 f0cbd3ec bellard
        lprint("          %6d connections dropped by rxmt timeout\r\n",
229 f0cbd3ec bellard
                        tcpstat.tcps_timeoutdrop);
230 f0cbd3ec bellard
        lprint("  %6d persist timeouts\r\n", tcpstat.tcps_persisttimeo);
231 f0cbd3ec bellard
        lprint("  %6d keepalive timeouts\r\n", tcpstat.tcps_keeptimeo);
232 f0cbd3ec bellard
        lprint("          %6d keepalive probes sent\r\n", tcpstat.tcps_keepprobe);
233 f0cbd3ec bellard
        lprint("          %6d connections dropped by keepalive\r\n", tcpstat.tcps_keepdrops);
234 f0cbd3ec bellard
        lprint("  %6d correct ACK header predictions\r\n", tcpstat.tcps_predack);
235 f0cbd3ec bellard
        lprint("  %6d correct data packet header predictions\n", tcpstat.tcps_preddat);
236 f0cbd3ec bellard
        lprint("  %6d TCP cache misses\r\n", tcpstat.tcps_socachemiss);
237 5fafdf24 ths
238 5fafdf24 ths
239 f0cbd3ec bellard
/*        lprint("    Packets received too short:                %d\r\n", tcpstat.tcps_rcvshort); */
240 f0cbd3ec bellard
/*        lprint("    Segments dropped due to PAWS:        %d\r\n", tcpstat.tcps_pawsdrop); */
241 f0cbd3ec bellard
242 f0cbd3ec bellard
}
243 f0cbd3ec bellard
244 31a60e22 blueswir1
static void
245 31a60e22 blueswir1
udpstats(void)
246 f0cbd3ec bellard
{
247 f0cbd3ec bellard
        lprint(" \r\n");
248 f0cbd3ec bellard
249 f0cbd3ec bellard
        lprint("UDP stats:\r\n");
250 f0cbd3ec bellard
        lprint("  %6d datagrams received\r\n", udpstat.udps_ipackets);
251 f0cbd3ec bellard
        lprint("  %6d with packets shorter than header\r\n", udpstat.udps_hdrops);
252 f0cbd3ec bellard
        lprint("  %6d with bad checksums\r\n", udpstat.udps_badsum);
253 f0cbd3ec bellard
        lprint("  %6d with data length larger than packet\r\n", udpstat.udps_badlen);
254 f0cbd3ec bellard
        lprint("  %6d UDP socket cache misses\r\n", udpstat.udpps_pcbcachemiss);
255 f0cbd3ec bellard
        lprint("  %6d datagrams sent\r\n", udpstat.udps_opackets);
256 f0cbd3ec bellard
}
257 f0cbd3ec bellard
258 31a60e22 blueswir1
static void
259 31a60e22 blueswir1
icmpstats(void)
260 f0cbd3ec bellard
{
261 f0cbd3ec bellard
        lprint(" \r\n");
262 f0cbd3ec bellard
        lprint("ICMP stats:\r\n");
263 f0cbd3ec bellard
        lprint("  %6d ICMP packets received\r\n", icmpstat.icps_received);
264 f0cbd3ec bellard
        lprint("  %6d were too short\r\n", icmpstat.icps_tooshort);
265 f0cbd3ec bellard
        lprint("  %6d with bad checksums\r\n", icmpstat.icps_checksum);
266 f0cbd3ec bellard
        lprint("  %6d with type not supported\r\n", icmpstat.icps_notsupp);
267 f0cbd3ec bellard
        lprint("  %6d with bad type feilds\r\n", icmpstat.icps_badtype);
268 f0cbd3ec bellard
        lprint("  %6d ICMP packets sent in reply\r\n", icmpstat.icps_reflect);
269 f0cbd3ec bellard
}
270 f0cbd3ec bellard
271 31a60e22 blueswir1
static void
272 31a60e22 blueswir1
mbufstats(void)
273 f0cbd3ec bellard
{
274 f0cbd3ec bellard
        struct mbuf *m;
275 f0cbd3ec bellard
        int i;
276 5fafdf24 ths
277 f0cbd3ec bellard
        lprint(" \r\n");
278 5fafdf24 ths
279 f0cbd3ec bellard
        lprint("Mbuf stats:\r\n");
280 f0cbd3ec bellard
281 f0cbd3ec bellard
        lprint("  %6d mbufs allocated (%d max)\r\n", mbuf_alloced, mbuf_max);
282 5fafdf24 ths
283 f0cbd3ec bellard
        i = 0;
284 f0cbd3ec bellard
        for (m = m_freelist.m_next; m != &m_freelist; m = m->m_next)
285 f0cbd3ec bellard
                i++;
286 f0cbd3ec bellard
        lprint("  %6d mbufs on free list\r\n",  i);
287 5fafdf24 ths
288 f0cbd3ec bellard
        i = 0;
289 f0cbd3ec bellard
        for (m = m_usedlist.m_next; m != &m_usedlist; m = m->m_next)
290 f0cbd3ec bellard
                i++;
291 f0cbd3ec bellard
        lprint("  %6d mbufs on used list\r\n",  i);
292 f0cbd3ec bellard
        lprint("  %6d mbufs queued as packets\r\n\r\n", if_queued);
293 f0cbd3ec bellard
}
294 31a60e22 blueswir1
#endif
295 f0cbd3ec bellard
296 31a60e22 blueswir1
#ifndef CONFIG_QEMU
297 f0cbd3ec bellard
void
298 f0cbd3ec bellard
slirp_exit(exit_status)
299 f0cbd3ec bellard
        int exit_status;
300 f0cbd3ec bellard
{
301 f0cbd3ec bellard
        struct ttys *ttyp;
302 5fafdf24 ths
303 f0cbd3ec bellard
        DEBUG_CALL("slirp_exit");
304 f0cbd3ec bellard
        DEBUG_ARG("exit_status = %d", exit_status);
305 f0cbd3ec bellard
306 f0cbd3ec bellard
        if (dostats) {
307 f0cbd3ec bellard
                lprint_print = (int (*) _P((void *, const char *, va_list)))vfprintf;
308 f0cbd3ec bellard
                if (!dfd)
309 f0cbd3ec bellard
                   debug_init("slirp_stats", 0xf);
310 f0cbd3ec bellard
                lprint_arg = (char **)&dfd;
311 3b46e624 ths
312 f0cbd3ec bellard
                ipstats();
313 f0cbd3ec bellard
                tcpstats();
314 f0cbd3ec bellard
                udpstats();
315 f0cbd3ec bellard
                icmpstats();
316 f0cbd3ec bellard
                mbufstats();
317 f0cbd3ec bellard
                sockstats();
318 f0cbd3ec bellard
                allttystats();
319 f0cbd3ec bellard
                vjstats();
320 f0cbd3ec bellard
        }
321 5fafdf24 ths
322 f0cbd3ec bellard
        for (ttyp = ttys; ttyp; ttyp = ttyp->next)
323 f0cbd3ec bellard
           tty_detached(ttyp, 1);
324 5fafdf24 ths
325 f0cbd3ec bellard
        if (slirp_forked) {
326 f0cbd3ec bellard
                /* Menendez time */
327 f0cbd3ec bellard
                if (kill(getppid(), SIGQUIT) < 0)
328 f0cbd3ec bellard
                        lprint("Couldn't kill parent process %ld!\n",
329 f0cbd3ec bellard
                            (long) getppid());
330 f0cbd3ec bellard
            }
331 5fafdf24 ths
332 f0cbd3ec bellard
        /* Restore the terminal if we gotta */
333 f0cbd3ec bellard
        if(slirp_tty_restore)
334 f0cbd3ec bellard
          tcsetattr(0,TCSANOW, &slirp_tty_settings);  /* NOW DAMMIT! */
335 f0cbd3ec bellard
        exit(exit_status);
336 f0cbd3ec bellard
}
337 f0cbd3ec bellard
#endif
338 31a60e22 blueswir1
339 31a60e22 blueswir1
void
340 31a60e22 blueswir1
slirp_stats(void)
341 31a60e22 blueswir1
{
342 31a60e22 blueswir1
#ifdef LOG_ENABLED
343 31a60e22 blueswir1
    ipstats();
344 31a60e22 blueswir1
    tcpstats();
345 31a60e22 blueswir1
    udpstats();
346 31a60e22 blueswir1
    icmpstats();
347 31a60e22 blueswir1
    mbufstats();
348 31a60e22 blueswir1
#else
349 31a60e22 blueswir1
    lprint("SLIRP statistics code not compiled.\n");
350 31a60e22 blueswir1
#endif
351 31a60e22 blueswir1
}