Skip to content

Commit

Permalink
Create tcp_mss.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DavadDi authored Jul 29, 2021
1 parent 103858a commit 3d30065
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions kprobe_ko_ex/tcp_mss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/python

from bcc import BPF

text="""
#ifndef KBUILD_MODNAME
#define KBUILD_MODNAME "bcc"
#endif
#include <linux/ip.h>
#include <linux/tcp.h>
#include <net/ip.h>
#include <uapi/linux/bpf.h>
int kretprobe__tcp_current_mss(struct pt_regs *ctx) {
struct sock *sk = (void *)PT_REGS_PARM1(ctx);
u32 mss = PT_REGS_RC(ctx);
if (!sk) {
return 0;
}
bpf_trace_printk("sk 0x%lx mss: %d\\n", sk, mss);
return 0;
}
"""

BPF(text=text).trace_print()

0 comments on commit 3d30065

Please sign in to comment.