From 2f72fbeeabad5fd9e19dbcc67d489b297e649e60 Mon Sep 17 00:00:00 2001 From: abs Date: Sun, 8 Jul 2001 15:59:18 +0000 Subject: [PATCH] Give TCPDEBUG a chance of working - fix printf() types, add missing &s, and remove attempt to use a non existant tcphdr field. --- sys/netinet/tcp_debug.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/netinet/tcp_debug.c b/sys/netinet/tcp_debug.c index 88a5cffb4e42..26d1386b0b01 100644 --- a/sys/netinet/tcp_debug.c +++ b/sys/netinet/tcp_debug.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_debug.c,v 1.14 1999/07/01 08:12:51 itojun Exp $ */ +/* $NetBSD: tcp_debug.c,v 1.15 2001/07/08 15:59:18 abs Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -153,7 +153,7 @@ tcp_trace(act, ostate, tp, m, req) break; bcopy(mtod(m, caddr_t), &td->td_ti, sizeof(td->td_ti)); #ifdef TCPDEBUG - th = (struct tcphdr *)((caddr_t)td->td_ti + sizeof(struct ip)); + th = (struct tcphdr *)((caddr_t)&td->td_ti + sizeof(struct ip)); #endif break; #ifdef INET6 @@ -163,7 +163,7 @@ tcp_trace(act, ostate, tp, m, req) bcopy(mtod(m, caddr_t), &td->td_ti6, sizeof(td->td_ti6)); #ifdef TCPDEBUG - th = (struct tcphdr *)((caddr_t)td->td_ti6 + sizeof(struct ip6_hdr)); + th = (struct tcphdr *)((caddr_t)&td->td_ti6 + sizeof(struct ip6_hdr)); #endif break; #endif @@ -174,7 +174,7 @@ tcp_trace(act, ostate, tp, m, req) if (tcpconsdebug == 0) return; if (tp) - printf("%x %s:", tp, tcpstates[ostate]); + printf("%p %s:", tp, tcpstates[ostate]); else printf("???????? "); printf("%s ", tanames[act]); @@ -187,7 +187,7 @@ tcp_trace(act, ostate, tp, m, req) break; seq = th->th_seq; ack = th->th_ack; - len = th->th_len; + len = m->m_pkthdr.len; if (act == TA_OUTPUT) { seq = ntohl(seq); ack = ntohl(ack); @@ -204,7 +204,7 @@ tcp_trace(act, ostate, tp, m, req) if (flags) { #ifndef lint char *cp = "<"; -#define pf(f) { if (th->th_flags&TH_/**/f) { printf("%s%s", cp, "f"); cp = ","; } } +#define pf(f) { if (th->th_flags&__CONCAT(TH_,f)) { printf("%s%s", cp, "f"); cp = ","; } } pf(SYN); pf(ACK); pf(FIN); pf(RST); pf(PUSH); pf(URG); #endif printf(">"); @@ -223,10 +223,10 @@ tcp_trace(act, ostate, tp, m, req) printf("\n"); if (tp == 0) return; - printf("\trcv_(nxt,wnd,up) (%x,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n", + printf("\trcv_(nxt,wnd,up) (%x,%lx,%x) snd_(una,nxt,max) (%x,%x,%x)\n", tp->rcv_nxt, tp->rcv_wnd, tp->rcv_up, tp->snd_una, tp->snd_nxt, tp->snd_max); - printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n", + printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%lx)\n", tp->snd_wl1, tp->snd_wl2, tp->snd_wnd); #endif /* TCPDEBUG */ }