Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P80469
(An Untitled Masterwork)
Active
Public
Actions
Authored by
CDanis
on Aug 1 2025, 7:45 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Tags
None
Referenced Files
F65701305: raw-paste-data.txt
Aug 1 2025, 7:45 PM
2025-08-01 19:45:53 (UTC+0)
Subscribers
None
#!/usr/bin/bpftrace
#
# Hook TCP listener connection completion and print the client's reported initial window size.
#
# You can see that rcv_wnd for the server socket is greatly decreased
# if a Linux client sets a small SO_RCVBUF:
# ```py
# sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, int(sys.argv[1]) if len(sys.argv) > 1 else 512)
# ```
#include <linux/tcp.h>
BEGIN
{
printf("%-16s %-24s %-8s %-8s\n", "", "Elapsed(us)", "snd_cwnd", "rcv_wnd", "snd_wnd");
}
kprobe:tcp_finish_connect
{
$tcps = (struct tcp_sock*)arg0;
printf("rcv\t\t0x%llx\t%lld\t%d\t\t**%d**\t\t%d\n", arg0, elapsed/1000, $tcps->snd_cwnd, $tcps->rcv_wnd, $tcps->snd_wnd);
}
Event Timeline
CDanis
created this paste.
Aug 1 2025, 7:45 PM
2025-08-01 19:45:53 (UTC+0)
Log In to Comment