diff --git a/client/internal/ebpf/ebpf/bpf_bpfeb.go b/client/internal/ebpf/ebpf/bpf_bpfeb.go index 5d276586246..04b19883b5a 100644 --- a/client/internal/ebpf/ebpf/bpf_bpfeb.go +++ b/client/internal/ebpf/ebpf/bpf_bpfeb.go @@ -1,6 +1,5 @@ // Code generated by bpf2go; DO NOT EDIT. //go:build arm64be || armbe || mips || mips64 || mips64p32 || ppc64 || s390 || s390x || sparc || sparc64 -// +build arm64be armbe mips mips64 mips64p32 ppc64 s390 s390x sparc sparc64 package ebpf diff --git a/client/internal/ebpf/ebpf/bpf_bpfeb.o b/client/internal/ebpf/ebpf/bpf_bpfeb.o index 0559da486eb..6e9cda44a65 100644 Binary files a/client/internal/ebpf/ebpf/bpf_bpfeb.o and b/client/internal/ebpf/ebpf/bpf_bpfeb.o differ diff --git a/client/internal/ebpf/ebpf/bpf_bpfel.go b/client/internal/ebpf/ebpf/bpf_bpfel.go index b94b79c5482..03b494aa2fd 100644 --- a/client/internal/ebpf/ebpf/bpf_bpfel.go +++ b/client/internal/ebpf/ebpf/bpf_bpfel.go @@ -1,6 +1,5 @@ // Code generated by bpf2go; DO NOT EDIT. -//go:build 386 || amd64 || amd64p32 || arm || arm64 || mips64le || mips64p32le || mipsle || ppc64le || riscv64 -// +build 386 amd64 amd64p32 arm arm64 mips64le mips64p32le mipsle ppc64le riscv64 +//go:build 386 || amd64 || amd64p32 || arm || arm64 || loong64 || mips64le || mips64p32le || mipsle || ppc64le || riscv64 package ebpf diff --git a/client/internal/ebpf/ebpf/bpf_bpfel.o b/client/internal/ebpf/ebpf/bpf_bpfel.o index 05fa42ecda2..6338f47742a 100644 Binary files a/client/internal/ebpf/ebpf/bpf_bpfel.o and b/client/internal/ebpf/ebpf/bpf_bpfel.o differ diff --git a/client/internal/ebpf/ebpf/src/dns_fwd.c b/client/internal/ebpf/ebpf/src/dns_fwd.c index 5228c7e758e..5f3fbcc3279 100644 --- a/client/internal/ebpf/ebpf/src/dns_fwd.c +++ b/client/internal/ebpf/ebpf/src/dns_fwd.c @@ -46,8 +46,8 @@ int xdp_dns_fwd(struct iphdr *ip, struct udphdr *udp) { if(!read_settings()){ return XDP_PASS; } - bpf_printk("dns port: %d", ntohs(dns_port)); - bpf_printk("dns ip: %d", ntohl(dns_ip)); + // bpf_printk("dns port: %d", ntohs(dns_port)); + // bpf_printk("dns ip: %d", ntohl(dns_ip)); } if (udp->dest == GENERAL_DNS_PORT && ip->daddr == dns_ip) { @@ -61,4 +61,4 @@ int xdp_dns_fwd(struct iphdr *ip, struct udphdr *udp) { } return XDP_PASS; -} \ No newline at end of file +} diff --git a/client/internal/ebpf/ebpf/src/prog.c b/client/internal/ebpf/ebpf/src/prog.c index 09b6493700f..f32103f2850 100644 --- a/client/internal/ebpf/ebpf/src/prog.c +++ b/client/internal/ebpf/ebpf/src/prog.c @@ -8,12 +8,6 @@ #include "dns_fwd.c" #include "wg_proxy.c" -#define bpf_printk(fmt, ...) \ - ({ \ - char ____fmt[] = fmt; \ - bpf_trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \ - }) - const __u16 flag_feature_wg_proxy = 0b01; const __u16 flag_feature_dns_fwd = 0b10; @@ -63,4 +57,4 @@ int nb_xdp_prog(struct xdp_md *ctx) { } return XDP_PASS; } -char _license[] SEC("license") = "GPL"; \ No newline at end of file +char _license[] SEC("license") = "GPL"; diff --git a/client/internal/ebpf/ebpf/src/readme.md b/client/internal/ebpf/ebpf/src/readme.md new file mode 100644 index 00000000000..f0582ea3257 --- /dev/null +++ b/client/internal/ebpf/ebpf/src/readme.md @@ -0,0 +1,12 @@ +# Debug + + +The CONFIG_BPF_EVENTS kernel module is required for bpf_printk. +Apply this code to use bpf_printk +``` +#define bpf_printk(fmt, ...) \ + ({ \ + char ____fmt[] = fmt; \ + bpf_trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \ + }) +``` diff --git a/client/internal/ebpf/ebpf/src/wg_proxy.c b/client/internal/ebpf/ebpf/src/wg_proxy.c index ecfedc6b398..88fea65cf58 100644 --- a/client/internal/ebpf/ebpf/src/wg_proxy.c +++ b/client/internal/ebpf/ebpf/src/wg_proxy.c @@ -34,7 +34,7 @@ int xdp_wg_proxy(struct iphdr *ip, struct udphdr *udp) { if (!read_port_settings()){ return XDP_PASS; } - bpf_printk("proxy port: %d, wg port: %d", proxy_port, wg_port); + // bpf_printk("proxy port: %d, wg port: %d", proxy_port, wg_port); } // 2130706433 = 127.0.0.1 @@ -51,4 +51,4 @@ int xdp_wg_proxy(struct iphdr *ip, struct udphdr *udp) { udp->dest = new_dst_port; udp->source = new_src_port; return XDP_PASS; -} \ No newline at end of file +}