1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/ptrace.h>
6 #include <netinet/in.h>
8 #include <bpf/bpf_helpers.h>
9 #include <bpf/bpf_tracing.h>
10 #include "bpf_trace_helpers.h"
12 static struct sockaddr_in old
;
14 SEC("kprobe/__sys_connect")
15 int BPF_KPROBE(handle_sys_connect
)
17 void *ptr
= (void *)PT_REGS_PARM2(ctx
);
18 struct sockaddr_in
new;
20 bpf_probe_read_user(&old
, sizeof(old
), ptr
);
21 __builtin_memset(&new, 0xab, sizeof(new));
22 bpf_probe_write_user(ptr
, &new, sizeof(new));
27 char _license
[] SEC("license") = "GPL";