static char sccsid
[] = "@(#)trpt.c 4.3 82/11/14";
#include <sys/socketvar.h>
#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
#include <netinet/ip_var.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>
struct tcp_debug tcp_debug
[TCP_NDEBUG
];
if (argc
> 0 && !strcmp(*argv
, "-s")) {
nlist(argc
> 0 ? *argv
: "/vmunix", nl
);
if (nl
[0].n_value
== 0) {
open(argc
> 1 ? argv
[1] : "/dev/kmem", 0);
nl
[0].n_value
&= 0x7fffffff;
nl
[1].n_value
&= 0x7fffffff;
lseek(0, nl
[1].n_value
, 0);
read(0, &tcp_debx
, sizeof (tcp_debx
));
printf("tcp_debx=%d\n", tcp_debx
);
lseek(0, nl
[0].n_value
, 0);
read(0, tcp_debug
, sizeof (tcp_debug
));
for (i
= tcp_debx
% TCP_NDEBUG
; i
< TCP_NDEBUG
; i
++) {
struct tcp_debug
*td
= &tcp_debug
[i
];
ntime
= ntohl(td
->td_time
);
tcp_trace(td
->td_act
, td
->td_ostate
, td
->td_tcb
, &td
->td_cb
,
for (i
= 0; i
< tcp_debx
% TCP_NDEBUG
; i
++) {
struct tcp_debug
*td
= &tcp_debug
[i
];
ntime
= ntohl(td
->td_time
);
tcp_trace(td
->td_act
, td
->td_ostate
, td
->td_tcb
, &td
->td_cb
,
tcp_trace(act
, ostate
, atp
, tp
, ti
, req
)
int len
, flags
, win
, timer
;
printf("%x %s:%s ", ((int)atp
)&0xfffff,
tcpstates
[ostate
], tanames
[act
]);
len
-= sizeof (struct tcphdr
);
printf("[%x..%x)", seq
, seq
+len
);
#define pf(f) { if (ti->ti_flags&TH_/**/f) { printf("%s%s", cp, "f"); cp = ","; } }
pf(SYN
); pf(ACK
); pf(FIN
); pf(RST
); pf(URG
);
printf("%s", prurequests
[req
]);
if (req
== PRU_SLOWTIMO
|| req
== PRU_FASTTIMO
)
printf("<%s>", tcptimers
[timer
]);
printf(" -> %s", tcpstates
[tp
->t_state
]);
/* print out internal state of tp !?! */
printf("\trcv_nxt %x rcv_wnd %d snd_una %x snd_nxt %x snd_max %x\n",
tp
->rcv_nxt
, tp
->rcv_wnd
, tp
->snd_una
, tp
->snd_nxt
, tp
->snd_max
);
printf("\tsnd_wl1 %x snd_wl2 %x snd_wnd %x\n", tp
->snd_wl1
, tp
->snd_wl2
, tp
->snd_wnd
);
printf("%03d ", (ms
/10) % 1000);