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