1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/ptrace.h>
4 #include <linux/bpf.h>
5 
6 #include <netinet/in.h>
7 
8 #include <bpf/bpf_helpers.h>
9 #include <bpf/bpf_tracing.h>
10 #include "bpf_trace_helpers.h"
11 
12 static struct sockaddr_in old;
13 
14 SEC("kprobe/__sys_connect")
15 int BPF_KPROBE(handle_sys_connect)
16 {
17 	void *ptr = (void *)PT_REGS_PARM2(ctx);
18 	struct sockaddr_in new;
19 
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));
23 
24 	return 0;
25 }
26 
27 char _license[] SEC("license") = "GPL";
28