#if defined(TARGET_PPC)
{ "cpustats", "", do_info_cpu_stats,
"", "show CPU statistics", },
+#endif
+#if defined(CONFIG_SLIRP)
+ { "slirp", "", do_info_slirp,
+ "", "show SLIRP statistics", },
#endif
{ NULL, NULL, },
};
/* Carry over one item from main.c so that the tty's restored.
* Only done when the tty being used is /dev/tty --RedWolf */
+#ifndef CONFIG_QEMU
extern struct termios slirp_tty_settings;
extern int slirp_tty_restore;
}
}
#endif
+#endif
+#ifdef LOG_ENABLED
#if 0
/*
* Statistic routines
* the link as well.
*/
-void
+static void
ttystats(ttyp)
struct ttys *ttyp;
{
lprint(" %6d bad input packets\r\n", is->in_mbad);
}
-void
-allttystats()
+static void
+allttystats(void)
{
struct ttys *ttyp;
}
#endif
-void
-ipstats()
+static void
+ipstats(void)
{
lprint(" \r\n");
lprint(" %6d total packets delivered\r\n", ipstat.ips_delivered);
}
-#if 0
-void
-vjstats()
+#ifndef CONFIG_QEMU
+static void
+vjstats(void)
{
lprint(" \r\n");
}
#endif
-void
-tcpstats()
+static void
+tcpstats(void)
{
lprint(" \r\n");
}
-void
-udpstats()
+static void
+udpstats(void)
{
lprint(" \r\n");
lprint(" %6d datagrams sent\r\n", udpstat.udps_opackets);
}
-void
-icmpstats()
+static void
+icmpstats(void)
{
lprint(" \r\n");
lprint("ICMP stats:\r\n");
lprint(" %6d ICMP packets sent in reply\r\n", icmpstat.icps_reflect);
}
-void
-mbufstats()
+static void
+mbufstats(void)
{
struct mbuf *m;
int i;
lprint(" %6d mbufs queued as packets\r\n\r\n", if_queued);
}
-void
-sockstats()
+static void
+sockstats(void)
{
char buff[256];
int n;
so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
}
+#endif
-#if 0
+#ifndef CONFIG_QEMU
void
slirp_exit(exit_status)
int exit_status;
exit(exit_status);
}
#endif
+
+void
+slirp_stats(void)
+{
+#ifdef LOG_ENABLED
+ ipstats();
+ tcpstats();
+ udpstats();
+ icmpstats();
+ mbufstats();
+ sockstats();
+#else
+ lprint("SLIRP statistics code not compiled.\n");
+#endif
+}
#endif
void debug_init _P((char *, int));
-//void ttystats _P((struct ttys *));
-void allttystats _P((void));
-void ipstats _P((void));
-void vjstats _P((void));
-void tcpstats _P((void));
-void udpstats _P((void));
-void icmpstats _P((void));
-void mbufstats _P((void));
-void sockstats _P((void));
-void slirp_exit _P((int));
{ "stats", CTLTYPE_STRUCT }, \
}
+#ifdef LOG_ENABLED
extern struct icmpstat icmpstat;
+#endif
#endif
#define ifs_init(ifm) ((ifm)->ifs_next = (ifm)->ifs_prev = (ifm))
+#ifdef LOG_ENABLED
/* Interface statistics */
struct slirp_ifstats {
u_int out_pkts; /* Output packets */
u_int in_mbad; /* Bad incoming packets */
};
+#endif
#endif
int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */
};
+#ifdef LOG_ENABLED
/*
* Structure attached to inpcb.ip_moptions and
* passed to ip_output when IP multicast options are in use.
};
extern struct ipstat ipstat;
+#endif
+
extern struct ipq ipq; /* ip reass. queue */
extern u_int16_t ip_id; /* ip packet ctr, for ids */
+
extern int ip_defttl; /* default IP ttl */
#endif
#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 */
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;
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;
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 */
(void ) ip_output((struct socket *)NULL, m);
- icmpstat.icps_reflect++;
+ STAT(icmpstat.icps_reflect++);
end_error:
return;
(void ) ip_output((struct socket *)NULL, m);
- icmpstat.icps_reflect++;
+ STAT(icmpstat.icps_reflect++);
}
#include "ip_icmp.h"
int ip_defttl;
+
+#ifdef LOG_ENABLED
struct ipstat ipstat;
+#endif
+
struct ipq ipq;
/*
DEBUG_ARG("m = %lx", (long)m);
DEBUG_ARG("m_len = %d", m->m_len);
- ipstat.ips_total++;
+ STAT(ipstat.ips_total++);
if (m->m_len < sizeof (struct ip)) {
- ipstat.ips_toosmall++;
+ STAT(ipstat.ips_toosmall++);
return;
}
ip = mtod(m, struct ip *);
if (ip->ip_v != IPVERSION) {
- ipstat.ips_badvers++;
+ STAT(ipstat.ips_badvers++);
goto bad;
}
hlen = ip->ip_hl << 2;
if (hlen<sizeof(struct ip ) || hlen>m->m_len) {/* min header length */
- ipstat.ips_badhlen++; /* or packet too short */
+ STAT(ipstat.ips_badhlen++); /* or packet too short */
goto bad;
}
* if (ip->ip_sum) {
*/
if(cksum(m,hlen)) {
- ipstat.ips_badsum++;
+ STAT(ipstat.ips_badsum++);
goto bad;
}
*/
NTOHS(ip->ip_len);
if (ip->ip_len < hlen) {
- ipstat.ips_badlen++;
+ STAT(ipstat.ips_badlen++);
goto bad;
}
NTOHS(ip->ip_id);
* Drop packet if shorter than we expect.
*/
if (m->m_len < ip->ip_len) {
- ipstat.ips_tooshort++;
+ STAT(ipstat.ips_tooshort++);
goto bad;
}
/* Should drop packet if mbuf too long? hmmm... */
* attempt reassembly; if it succeeds, proceed.
*/
if (((struct ipasfrag *)ip)->ipf_mff & 1 || ip->ip_off) {
- ipstat.ips_fragments++;
+ STAT(ipstat.ips_fragments++);
ip = ip_reass((struct ipasfrag *)ip, fp);
if (ip == 0)
return;
- ipstat.ips_reassembled++;
+ STAT(ipstat.ips_reassembled++);
m = dtom(ip);
} else
if (fp)
/*
* Switch out to protocol's input routine.
*/
- ipstat.ips_delivered++;
+ STAT(ipstat.ips_delivered++);
switch (ip->ip_p) {
case IPPROTO_TCP:
tcp_input(m, hlen, (struct socket *)NULL);
icmp_input(m, hlen);
break;
default:
- ipstat.ips_noproto++;
+ STAT(ipstat.ips_noproto++);
m_free(m);
}
return;
return ((struct ip *)ip);
dropfrag:
- ipstat.ips_fragdropped++;
+ STAT(ipstat.ips_fragdropped++);
m_freem(m);
return (0);
}
--fp->ipq_ttl;
fp = (struct ipq *) fp->next;
if (((struct ipq *)(fp->prev))->ipq_ttl == 0) {
- ipstat.ips_fragtimeout++;
+ STAT(ipstat.ips_fragtimeout++);
ip_freef((struct ipq *) fp->prev);
}
}
/* Not yet */
icmp_error(m, type, code, 0, 0);
- ipstat.ips_badoptions++;
+ STAT(ipstat.ips_badoptions++);
return (1);
}
ip->ip_off &= IP_DF;
ip->ip_id = htons(ip_id++);
ip->ip_hl = hlen >> 2;
- ipstat.ips_localout++;
+ STAT(ipstat.ips_localout++);
/*
* Verify that we have any chance at all of being able to queue
*/
if (ip->ip_off & IP_DF) {
error = -1;
- ipstat.ips_cantfrag++;
+ STAT(ipstat.ips_cantfrag++);
goto bad;
}
m = m_get();
if (m == 0) {
error = -1;
- ipstat.ips_odropped++;
+ STAT(ipstat.ips_odropped++);
goto sendorfree;
}
m->m_data += if_maxlinkhdr;
mhip->ip_sum = cksum(m, mhlen);
*mnext = m;
mnext = &m->m_nextpkt;
- ipstat.ips_ofragments++;
+ STAT(ipstat.ips_ofragments++);
}
/*
* Update first fragment by trimming what's been copied out
}
if (error == 0)
- ipstat.ips_fragmented++;
+ STAT(ipstat.ips_fragmented++);
}
done:
extern const char *tftp_prefix;
extern char slirp_hostname[33];
+void slirp_stats(void);
+
#ifdef __cplusplus
}
#endif
}
#endif
+#ifdef CONFIG_QEMU
+void lprint(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ term_vprintf(format, args);
+ va_end(args);
+}
+#else
int (*lprint_print) _P((void *, const char *, va_list));
char *lprint_ptr, *lprint_ptr2, **lprint_arg;
lprint("Adding emulation for %s to port %d/%d\r\n", buff1, emup->lport, emup->fport);
}
+#endif
#ifdef BAD_SPRINTF
if (!f)
return -1;
+#ifdef DEBUG
lprint("IP address of your DNS(s): ");
+#endif
while (fgets(buff, 512, f) != NULL) {
if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) {
if (!inet_aton(buff2, &tmp_addr))
/* If it's the first one, set it to dns_addr */
if (!found)
*pdns_addr = tmp_addr;
+#ifdef DEBUG
else
lprint(", ");
+#endif
if (++found > 3) {
+#ifdef DEBUG
lprint("(more)");
+#endif
break;
- } else
+ }
+#ifdef DEBUG
+ else
lprint("%s", inet_ntoa(tmp_addr));
+#endif
}
}
fclose(f);
#define CONFIG_QEMU
-#define DEBUG 1
+//#define DEBUG 1
+
+// Uncomment the following line to enable SLIRP statistics printing in Qemu
+//#define LOG_ENABLED
+
+#ifdef LOG_ENABLED
+#define STAT(expr) expr
+#else
+#define STAT(expr) do { } while(0)
+#endif
#ifndef CONFIG_QEMU
#include "version.h"
tp->t_flags |= TF_DELACK; \
(tp)->rcv_nxt += (ti)->ti_len; \
flags = (ti)->ti_flags & TH_FIN; \
- tcpstat.tcps_rcvpack++;\
- tcpstat.tcps_rcvbyte += (ti)->ti_len;\
+ STAT(tcpstat.tcps_rcvpack++); \
+ STAT(tcpstat.tcps_rcvbyte += (ti)->ti_len); \
if (so->so_emu) { \
if (tcp_emu((so),(m))) sbappend((so), (m)); \
} else \
tp->t_flags |= TF_DELACK; \
(tp)->rcv_nxt += (ti)->ti_len; \
flags = (ti)->ti_flags & TH_FIN; \
- tcpstat.tcps_rcvpack++;\
- tcpstat.tcps_rcvbyte += (ti)->ti_len;\
+ STAT(tcpstat.tcps_rcvpack++); \
+ STAT(tcpstat.tcps_rcvbyte += (ti)->ti_len); \
if (so->so_emu) { \
if (tcp_emu((so),(m))) sbappend(so, (m)); \
} else \
i = q->ti_seq + q->ti_len - ti->ti_seq;
if (i > 0) {
if (i >= ti->ti_len) {
- tcpstat.tcps_rcvduppack++;
- tcpstat.tcps_rcvdupbyte += ti->ti_len;
+ STAT(tcpstat.tcps_rcvduppack++);
+ STAT(tcpstat.tcps_rcvdupbyte += ti->ti_len);
m_freem(m);
/*
* Try to present any queued data
}
q = (struct tcpiphdr *)(q->ti_next);
}
- tcpstat.tcps_rcvoopack++;
- tcpstat.tcps_rcvoobyte += ti->ti_len;
+ STAT(tcpstat.tcps_rcvoopack++);
+ STAT(tcpstat.tcps_rcvoobyte += ti->ti_len);
REASS_MBUF(ti) = (mbufp_32) m; /* XXX */
/*
}
- tcpstat.tcps_rcvtotal++;
+ STAT(tcpstat.tcps_rcvtotal++);
/*
* Get IP and TCP header together in first mbuf.
* Note: IP leaves IP header in first mbuf.
* ti->ti_sum = cksum(m, len);
* if (ti->ti_sum) { */
if(cksum(m, len)) {
- tcpstat.tcps_rcvbadsum++;
+ STAT(tcpstat.tcps_rcvbadsum++);
goto drop;
}
*/
off = ti->ti_off << 2;
if (off < sizeof (struct tcphdr) || off > tlen) {
- tcpstat.tcps_rcvbadoff++;
+ STAT(tcpstat.tcps_rcvbadoff++);
goto drop;
}
tlen -= off;
ti->ti_dst, ti->ti_dport);
if (so)
tcp_last_so = so;
- ++tcpstat.tcps_socachemiss;
+ STAT(tcpstat.tcps_socachemiss++);
}
/*
/*
* this is a pure ack for outstanding data.
*/
- ++tcpstat.tcps_predack;
+ STAT(tcpstat.tcps_predack++);
/* if (ts_present)
* tcp_xmit_timer(tp, tcp_now-ts_ecr+1);
* else
SEQ_GT(ti->ti_ack, tp->t_rtseq))
tcp_xmit_timer(tp, tp->t_rtt);
acked = ti->ti_ack - tp->snd_una;
- tcpstat.tcps_rcvackpack++;
- tcpstat.tcps_rcvackbyte += acked;
+ STAT(tcpstat.tcps_rcvackpack++);
+ STAT(tcpstat.tcps_rcvackbyte += acked);
sbdrop(&so->so_snd, acked);
tp->snd_una = ti->ti_ack;
m_freem(m);
* with nothing on the reassembly queue and
* we have enough buffer space to take it.
*/
- ++tcpstat.tcps_preddat;
+ STAT(tcpstat.tcps_preddat++);
tp->rcv_nxt += ti->ti_len;
- tcpstat.tcps_rcvpack++;
- tcpstat.tcps_rcvbyte += ti->ti_len;
+ STAT(tcpstat.tcps_rcvpack++);
+ STAT(tcpstat.tcps_rcvbyte += ti->ti_len);
/*
* Add data to socket buffer.
*/
tp->t_flags |= TF_ACKNOW;
tp->t_state = TCPS_SYN_RECEIVED;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
- tcpstat.tcps_accepts++;
+ STAT(tcpstat.tcps_accepts++);
goto trimthenstep6;
} /* case TCPS_LISTEN */
tcp_rcvseqinit(tp);
tp->t_flags |= TF_ACKNOW;
if (tiflags & TH_ACK && SEQ_GT(tp->snd_una, tp->iss)) {
- tcpstat.tcps_connects++;
+ STAT(tcpstat.tcps_connects++);
soisfconnected(so);
tp->t_state = TCPS_ESTABLISHED;
m_adj(m, -todrop);
ti->ti_len = tp->rcv_wnd;
tiflags &= ~TH_FIN;
- tcpstat.tcps_rcvpackafterwin++;
- tcpstat.tcps_rcvbyteafterwin += todrop;
+ STAT(tcpstat.tcps_rcvpackafterwin++);
+ STAT(tcpstat.tcps_rcvbyteafterwin += todrop);
}
tp->snd_wl1 = ti->ti_seq - 1;
tp->rcv_up = ti->ti_seq;
*/
tp->t_flags |= TF_ACKNOW;
todrop = ti->ti_len;
- tcpstat.tcps_rcvduppack++;
- tcpstat.tcps_rcvdupbyte += todrop;
+ STAT(tcpstat.tcps_rcvduppack++);
+ STAT(tcpstat.tcps_rcvdupbyte += todrop);
} else {
- tcpstat.tcps_rcvpartduppack++;
- tcpstat.tcps_rcvpartdupbyte += todrop;
+ STAT(tcpstat.tcps_rcvpartduppack++);
+ STAT(tcpstat.tcps_rcvpartdupbyte += todrop);
}
m_adj(m, todrop);
ti->ti_seq += todrop;
if ((so->so_state & SS_NOFDREF) &&
tp->t_state > TCPS_CLOSE_WAIT && ti->ti_len) {
tp = tcp_close(tp);
- tcpstat.tcps_rcvafterclose++;
+ STAT(tcpstat.tcps_rcvafterclose++);
goto dropwithreset;
}
*/
todrop = (ti->ti_seq+ti->ti_len) - (tp->rcv_nxt+tp->rcv_wnd);
if (todrop > 0) {
- tcpstat.tcps_rcvpackafterwin++;
+ STAT(tcpstat.tcps_rcvpackafterwin++);
if (todrop >= ti->ti_len) {
- tcpstat.tcps_rcvbyteafterwin += ti->ti_len;
+ STAT(tcpstat.tcps_rcvbyteafterwin += ti->ti_len);
/*
* If a new connection request is received
* while in TIME_WAIT, drop the old connection
*/
if (tp->rcv_wnd == 0 && ti->ti_seq == tp->rcv_nxt) {
tp->t_flags |= TF_ACKNOW;
- tcpstat.tcps_rcvwinprobe++;
+ STAT(tcpstat.tcps_rcvwinprobe++);
} else
goto dropafterack;
} else
- tcpstat.tcps_rcvbyteafterwin += todrop;
+ STAT(tcpstat.tcps_rcvbyteafterwin += todrop);
m_adj(m, -todrop);
ti->ti_len -= todrop;
tiflags &= ~(TH_PUSH|TH_FIN);
/* so->so_error = ECONNRESET; */
close:
tp->t_state = TCPS_CLOSED;
- tcpstat.tcps_drops++;
+ STAT(tcpstat.tcps_drops++);
tp = tcp_close(tp);
goto drop;
if (SEQ_GT(tp->snd_una, ti->ti_ack) ||
SEQ_GT(ti->ti_ack, tp->snd_max))
goto dropwithreset;
- tcpstat.tcps_connects++;
+ STAT(tcpstat.tcps_connects++);
tp->t_state = TCPS_ESTABLISHED;
/*
* The sent SYN is ack'ed with our sequence number +1
if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) {
if (ti->ti_len == 0 && tiwin == tp->snd_wnd) {
- tcpstat.tcps_rcvdupack++;
+ STAT(tcpstat.tcps_rcvdupack++);
DEBUG_MISC((dfd," dup ack m = %lx so = %lx \n",
(long )m, (long )so));
/*
tp->snd_cwnd = tp->snd_ssthresh;
tp->t_dupacks = 0;
if (SEQ_GT(ti->ti_ack, tp->snd_max)) {
- tcpstat.tcps_rcvacktoomuch++;
+ STAT(tcpstat.tcps_rcvacktoomuch++);
goto dropafterack;
}
acked = ti->ti_ack - tp->snd_una;
- tcpstat.tcps_rcvackpack++;
- tcpstat.tcps_rcvackbyte += acked;
+ STAT(tcpstat.tcps_rcvackpack++);
+ STAT(tcpstat.tcps_rcvackbyte += acked);
/*
* If we have a timestamp reply, update smoothed
/* keep track of pure window updates */
if (ti->ti_len == 0 &&
tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd)
- tcpstat.tcps_rcvwinupd++;
+ STAT(tcpstat.tcps_rcvwinupd++);
tp->snd_wnd = tiwin;
tp->snd_wl1 = ti->ti_seq;
tp->snd_wl2 = ti->ti_ack;
DEBUG_ARG("tp = %lx", (long)tp);
DEBUG_ARG("rtt = %d", rtt);
- tcpstat.tcps_rttupdated++;
+ STAT(tcpstat.tcps_rttupdated++);
if (tp->t_srtt != 0) {
/*
* srtt is stored as fixed point with 3 bits after the
/*
* No reason to send a segment, just return.
*/
- tcpstat.tcps_didnuttin++;
+ STAT(tcpstat.tcps_didnuttin++);
return (0);
*/
if (len) {
if (tp->t_force && len == 1)
- tcpstat.tcps_sndprobe++;
+ STAT(tcpstat.tcps_sndprobe++);
else if (SEQ_LT(tp->snd_nxt, tp->snd_max)) {
- tcpstat.tcps_sndrexmitpack++;
- tcpstat.tcps_sndrexmitbyte += len;
+ STAT(tcpstat.tcps_sndrexmitpack++);
+ STAT(tcpstat.tcps_sndrexmitbyte += len);
} else {
- tcpstat.tcps_sndpack++;
- tcpstat.tcps_sndbyte += len;
+ STAT(tcpstat.tcps_sndpack++);
+ STAT(tcpstat.tcps_sndbyte += len);
}
m = m_get();
flags |= TH_PUSH;
} else {
if (tp->t_flags & TF_ACKNOW)
- tcpstat.tcps_sndacks++;
+ STAT(tcpstat.tcps_sndacks++);
else if (flags & (TH_SYN|TH_FIN|TH_RST))
- tcpstat.tcps_sndctrl++;
+ STAT(tcpstat.tcps_sndctrl++);
else if (SEQ_GT(tp->snd_up, tp->snd_una))
- tcpstat.tcps_sndurg++;
+ STAT(tcpstat.tcps_sndurg++);
else
- tcpstat.tcps_sndwinup++;
+ STAT(tcpstat.tcps_sndwinup++);
m = m_get();
if (m == NULL) {
if (tp->t_rtt == 0) {
tp->t_rtt = 1;
tp->t_rtseq = startseq;
- tcpstat.tcps_segstimed++;
+ STAT(tcpstat.tcps_segstimed++);
}
}
*/
return (error);
}
- tcpstat.tcps_sndtotal++;
+ STAT(tcpstat.tcps_sndtotal++);
/*
* Data sent (as far as we can tell).
if (TCPS_HAVERCVDSYN(tp->t_state)) {
tp->t_state = TCPS_CLOSED;
(void) tcp_output(tp);
- tcpstat.tcps_drops++;
+ STAT(tcpstat.tcps_drops++);
} else
- tcpstat.tcps_conndrops++;
+ STAT(tcpstat.tcps_conndrops++);
/* if (errno == ETIMEDOUT && tp->t_softerror)
* errno = tp->t_softerror;
*/
sbfree(&so->so_rcv);
sbfree(&so->so_snd);
sofree(so);
- tcpstat.tcps_closed++;
+ STAT(tcpstat.tcps_closed++);
return ((struct tcpcb *)0);
}
*/
/* soisconnecting(so); */ /* NOFDREF used instead */
- tcpstat.tcps_connattempt++;
+ STAT(tcpstat.tcps_connattempt++);
tp->t_state = TCPS_SYN_SENT;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
/*soisfconnecting(ns);*/
- tcpstat.tcps_connattempt++;
+ STAT(tcpstat.tcps_connattempt++);
tp->t_state = TCPS_SYN_SENT;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
int tcp_maxidle;
int so_options = DO_KEEPALIVE;
+#ifdef LOG_ENABLED
struct tcpstat tcpstat; /* tcp statistics */
+#endif
+
u_int32_t tcp_now; /* for RFC 1323 timestamps */
/*
(tp->t_flags & TF_DELACK)) {
tp->t_flags &= ~TF_DELACK;
tp->t_flags |= TF_ACKNOW;
- tcpstat.tcps_delack++;
+ STAT(tcpstat.tcps_delack++);
(void) tcp_output(tp);
}
}
* We tried our best, now the connection must die!
*/
tp->t_rxtshift = TCP_MAXRXTSHIFT;
- tcpstat.tcps_timeoutdrop++;
+ STAT(tcpstat.tcps_timeoutdrop++);
tp = tcp_drop(tp, tp->t_softerror);
/* tp->t_softerror : ETIMEDOUT); */ /* XXX */
return (tp); /* XXX */
*/
tp->t_rxtshift = 6;
}
- tcpstat.tcps_rexmttimeo++;
+ STAT(tcpstat.tcps_rexmttimeo++);
rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
TCPT_RANGESET(tp->t_rxtcur, rexmt,
(short)tp->t_rttmin, TCPTV_REXMTMAX); /* XXX */
* Force a byte to be output, if possible.
*/
case TCPT_PERSIST:
- tcpstat.tcps_persisttimeo++;
+ STAT(tcpstat.tcps_persisttimeo++);
tcp_setpersist(tp);
tp->t_force = 1;
(void) tcp_output(tp);
* or drop connection if idle for too long.
*/
case TCPT_KEEP:
- tcpstat.tcps_keeptimeo++;
+ STAT(tcpstat.tcps_keeptimeo++);
if (tp->t_state < TCPS_ESTABLISHED)
goto dropit;
* by the protocol spec, this requires the
* correspondent TCP to respond.
*/
- tcpstat.tcps_keepprobe++;
+ STAT(tcpstat.tcps_keepprobe++);
#ifdef TCP_COMPAT_42
/*
* The keepalive packet must have nonzero length
break;
dropit:
- tcpstat.tcps_keepdrops++;
+ STAT(tcpstat.tcps_keepdrops++);
tp = tcp_drop(tp, 0); /* ETIMEDOUT); */
break;
}
#endif
#define REASS_MBUF(ti) (*(mbufp_32 *)&((ti)->ti_t))
+#ifdef LOG_ENABLED
/*
* TCP statistics.
* Many of these should be kept per connection,
};
extern struct tcpstat tcpstat; /* tcp statistics */
+#endif
+
extern u_int32_t tcp_now; /* for RFC 1323 timestamps */
#endif
#include <slirp.h>
#include "ip_icmp.h"
+#ifdef LOG_ENABLED
struct udpstat udpstat;
+#endif
struct socket udb;
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,
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);
* if (uh->uh_sum) {
*/
if(cksum(m, len + sizeof(struct ip))) {
- udpstat.udps_badsum++;
+ STAT(udpstat.udps_badsum++);
goto bad;
}
}
if (tmp == &udb) {
so = NULL;
} else {
- udpstat.udpps_pcbcachemiss++;
+ STAT(udpstat.udpps_pcbcachemiss++);
udp_last_so = so;
}
}
((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);
#define ui_ulen ui_u.uh_ulen
#define ui_sum ui_u.uh_sum
+#ifdef LOG_ENABLED
struct udpstat {
/* input statistics: */
u_long udps_ipackets; /* total input packets */
/* output statistics: */
u_long udps_opackets; /* total output packets */
};
+#endif
/*
* Names for UDP sysctl objects
#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */
#define UDPCTL_MAXID 2
+#ifdef LOG_ENABLED
extern struct udpstat udpstat;
+#endif
+
extern struct socket udb;
struct mbuf;
}
#endif /* !defined(_WIN32) */
+void do_info_slirp(void)
+{
+ slirp_stats();
+}
#endif /* CONFIG_SLIRP */
extern int nb_nics;
extern NICInfo nd_table[MAX_NICS];
+/* SLIRP */
+void do_info_slirp(void);
+
/* timers */
typedef struct QEMUClock QEMUClock;