summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/tcp_debug.c')
-rw-r--r--sys/netinet/tcp_debug.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sys/netinet/tcp_debug.c b/sys/netinet/tcp_debug.c
index 09ab874665b..f604cf2d5ae 100644
--- a/sys/netinet/tcp_debug.c
+++ b/sys/netinet/tcp_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_debug.c,v 1.14 2003/05/14 01:12:27 jason Exp $ */
+/* $OpenBSD: tcp_debug.c,v 1.15 2003/05/29 00:35:18 itojun Exp $ */
/* $NetBSD: tcp_debug.c,v 1.10 1996/02/13 23:43:36 christos Exp $ */
/*
@@ -113,16 +113,16 @@ int tcpconsdebug = 0;
#endif
struct tcp_debug tcp_debug[TCP_NDEBUG];
-int tcp_debx;
+int tcp_debx = 0;
/*
* Tcp debug routines
*/
void
-tcp_trace(act, ostate, tp, headers, req, len)
+tcp_trace(act, ostate, tp, m, req, len)
short act, ostate;
struct tcpcb *tp;
- caddr_t headers;
+ struct mbuf *m;
int req;
int len;
{
@@ -130,15 +130,27 @@ tcp_trace(act, ostate, tp, headers, req, len)
tcp_seq seq, ack;
int flags;
#endif
- struct tcp_debug *td = &tcp_debug[tcp_debx++];
- struct tcpiphdr *ti = (struct tcpiphdr *)headers;
+ caddr_t headers;
+ struct tcp_debug *td;
+ struct tcpiphdr *ti;
struct tcphdr *th;
#ifdef INET6
struct tcpipv6hdr *ti6 = (struct tcpipv6hdr *)ti;
#endif
+ td = &tcp_debug[tcp_debx++];
if (tcp_debx == TCP_NDEBUG)
tcp_debx = 0;
+
+ if (m)
+ headers = mtod(m, caddr_t);
+ else
+ headers = NULL;
+ ti = (struct tcpiphdr *)headers;
+#ifdef INET6
+ ti6 = (struct tcpipv6hdr *)headers;
+#endif
+
td->td_time = iptime();
td->td_act = act;
td->td_ostate = ostate;
@@ -150,7 +162,7 @@ tcp_trace(act, ostate, tp, headers, req, len)
switch (tp->pf) {
#ifdef INET6
case PF_INET6:
- if (ti) {
+ if (ti6) {
th = &ti6->ti6_t;
td->td_ti6 = *ti6;
} else