Page MenuHomeFreeBSD
Authored By
tuexen
Jun 16 2018, 5:46 PM
Size
1 KB
Referenced Files
None
Subscribers
None

tcptest.d

#!/usr/sbin/dtrace -s
#pragma D option quiet
#pragma D option switchrate=10hz
dtrace:::BEGIN
{
printf(" %3s %15s:%-5s %15s:%-5s %6s %s\n", "CPU",
"LADDR", "LPORT", "RADDR", "RPORT", "BYTES", "FLAGS");
}
tcp:::send
{
printf(" %3d %16s:%-5d -> %16s:%-5d %6d (", cpu,
args[3]->tcps_laddr, args[3]->tcps_lport,
args[3]->tcps_laddr, args[3]->tcps_rport,
args[2]->ip_plength);
}
tcp:::receive
{
printf(" %3d %16s:%-5d <- %16s:%-5d %6d (", cpu,
args[3]->tcps_laddr, args[3]->tcps_lport,
args[3]->tcps_raddr, args[3]->tcps_rport,
args[2]->ip_plength);
}
tcp:::send,
tcp:::receive
{
printf("%s", args[4]->tcp_flags & TH_FIN ? "FIN|" : "");
printf("%s", args[4]->tcp_flags & TH_SYN ? "SYN|" : "");
printf("%s", args[4]->tcp_flags & TH_RST ? "RST|" : "");
printf("%s", args[4]->tcp_flags & TH_PUSH ? "PUSH|" : "");
printf("%s", args[4]->tcp_flags & TH_ACK ? "ACK|" : "");
printf("%s", args[4]->tcp_flags & TH_URG ? "URG|" : "");
printf("%s", args[4]->tcp_flags & TH_ECE ? "ECE|" : "");
printf("%s", args[4]->tcp_flags & TH_CWR ? "CWR|" : "");
printf("%s", args[4]->tcp_flags == 0 ? "null " : "");
printf("\b)\n");
}

File Metadata

Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1396654
Default Alt Text
tcptest.d (1 KB)

Event Timeline