fix bug that can cause recursive .forward files to fail
[unix-history] / usr / src / sys / netinet / tcp_debug.c
index 0d3bcc0..444a853 100644 (file)
@@ -1,35 +1,51 @@
-/*     tcp_debug.c     4.8     82/10/30        */
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ *
+ *     @(#)tcp_debug.c 8.1 (Berkeley) %G%
+ */
 
 
-#include "../h/param.h"
-#include "../h/systm.h"
-#include "../h/mbuf.h"
-#include "../h/socket.h"
-#include "../h/socketvar.h"
+#ifdef TCPDEBUG
+/* load symbolic names */
 #define PRUREQUESTS
 #define PRUREQUESTS
-#include "../h/protosw.h"
-#include "../netinet/in.h"
-#include "../net/route.h"
-#include "../netinet/in_pcb.h"
-#include "../netinet/in_systm.h"
-#include "../net/if.h"
-#include "../netinet/ip.h"
-#include "../netinet/ip_var.h"
-#include "../netinet/tcp.h"
 #define TCPSTATES
 #define TCPSTATES
-#include "../netinet/tcp_fsm.h"
-#include "../netinet/tcp_seq.h"
 #define        TCPTIMERS
 #define        TCPTIMERS
-#include "../netinet/tcp_timer.h"
-#include "../netinet/tcp_var.h"
-#include "../netinet/tcpip.h"
 #define        TANAMES
 #define        TANAMES
-#include "../netinet/tcp_debug.h"
-#include <errno.h>
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/protosw.h>
+#include <sys/errno.h>
 
 
+#include <net/route.h>
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/in_pcb.h>
+#include <netinet/ip_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcp_fsm.h>
+#include <netinet/tcp_seq.h>
+#include <netinet/tcp_timer.h>
+#include <netinet/tcp_var.h>
+#include <netinet/tcpip.h>
+#include <netinet/tcp_debug.h>
+
+#ifdef TCPDEBUG
 int    tcpconsdebug = 0;
 int    tcpconsdebug = 0;
+#endif
 /*
  * Tcp debug routines
  */
 /*
  * Tcp debug routines
  */
+void
 tcp_trace(act, ostate, tp, ti, req)
        short act, ostate;
        struct tcpcb *tp;
 tcp_trace(act, ostate, tp, ti, req)
        short act, ostate;
        struct tcpcb *tp;
@@ -55,6 +71,7 @@ tcp_trace(act, ostate, tp, ti, req)
        else
                bzero((caddr_t)&td->td_ti, sizeof (*ti));
        td->td_req = req;
        else
                bzero((caddr_t)&td->td_ti, sizeof (*ti));
        td->td_req = req;
+#ifdef TCPDEBUG
        if (tcpconsdebug == 0)
                return;
        if (tp)
        if (tcpconsdebug == 0)
                return;
        if (tp)
@@ -66,6 +83,9 @@ tcp_trace(act, ostate, tp, ti, req)
 
        case TA_INPUT:
        case TA_OUTPUT:
 
        case TA_INPUT:
        case TA_OUTPUT:
+       case TA_DROP:
+               if (ti == 0)
+                       break;
                seq = ti->ti_seq;
                ack = ti->ti_ack;
                len = ti->ti_len;
                seq = ti->ti_seq;
                ack = ti->ti_ack;
                len = ti->ti_len;
@@ -80,13 +100,13 @@ tcp_trace(act, ostate, tp, ti, req)
                        printf("[%x..%x)", seq, seq+len);
                else
                        printf("%x", seq);
                        printf("[%x..%x)", seq, seq+len);
                else
                        printf("%x", seq);
-               printf("@%x", ack);
+               printf("@%x, urp=%x", ack, ti->ti_urp);
                flags = ti->ti_flags;
                if (flags) {
 #ifndef lint
                        char *cp = "<";
 #define pf(f) { if (ti->ti_flags&TH_/**/f) { printf("%s%s", cp, "f"); cp = ","; } }
                flags = ti->ti_flags;
                if (flags) {
 #ifndef lint
                        char *cp = "<";
 #define pf(f) { if (ti->ti_flags&TH_/**/f) { printf("%s%s", cp, "f"); cp = ","; } }
-                       pf(SYN); pf(ACK); pf(FIN); pf(RST);
+                       pf(SYN); pf(ACK); pf(FIN); pf(RST); pf(PUSH); pf(URG);
 #endif
                        printf(">");
                }
 #endif
                        printf(">");
                }
@@ -104,8 +124,10 @@ tcp_trace(act, ostate, tp, ti, req)
        printf("\n");
        if (tp == 0)
                return;
        printf("\n");
        if (tp == 0)
                return;
-       printf("\trcv_(nxt,wnd) (%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n",
-           tp->rcv_nxt, tp->rcv_wnd, tp->snd_una, tp->snd_nxt, tp->snd_max);
+       printf("\trcv_(nxt,wnd,up) (%x,%x,%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",
            tp->snd_wl1, tp->snd_wl2, tp->snd_wnd);
        printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n",
            tp->snd_wl1, tp->snd_wl2, tp->snd_wnd);
+#endif /* TCPDEBUG */
 }
 }