Remove debug lines (#1468)

Remove print lines from EBPF code
This commit is contained in:
Zoltan Papp 2024-01-15 18:04:19 +01:00 committed by GitHub
parent e9c967b27c
commit 5a7aa461de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 15 deletions

View File

@ -1,6 +1,5 @@
// Code generated by bpf2go; DO NOT EDIT. // Code generated by bpf2go; DO NOT EDIT.
//go:build arm64be || armbe || mips || mips64 || mips64p32 || ppc64 || s390 || s390x || sparc || sparc64 //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 package ebpf

View File

@ -1,6 +1,5 @@
// Code generated by bpf2go; DO NOT EDIT. // Code generated by bpf2go; DO NOT EDIT.
//go:build 386 || amd64 || amd64p32 || arm || arm64 || mips64le || mips64p32le || mipsle || ppc64le || riscv64 //go:build 386 || amd64 || amd64p32 || arm || arm64 || loong64 || mips64le || mips64p32le || mipsle || ppc64le || riscv64
// +build 386 amd64 amd64p32 arm arm64 mips64le mips64p32le mipsle ppc64le riscv64
package ebpf package ebpf

View File

@ -46,8 +46,8 @@ int xdp_dns_fwd(struct iphdr *ip, struct udphdr *udp) {
if(!read_settings()){ if(!read_settings()){
return XDP_PASS; return XDP_PASS;
} }
bpf_printk("dns port: %d", ntohs(dns_port)); // bpf_printk("dns port: %d", ntohs(dns_port));
bpf_printk("dns ip: %d", ntohl(dns_ip)); // bpf_printk("dns ip: %d", ntohl(dns_ip));
} }
if (udp->dest == GENERAL_DNS_PORT && ip->daddr == dns_ip) { if (udp->dest == GENERAL_DNS_PORT && ip->daddr == dns_ip) {

View File

@ -8,12 +8,6 @@
#include "dns_fwd.c" #include "dns_fwd.c"
#include "wg_proxy.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_wg_proxy = 0b01;
const __u16 flag_feature_dns_fwd = 0b10; const __u16 flag_feature_dns_fwd = 0b10;

View File

@ -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__); \
})
```

View File

@ -34,7 +34,7 @@ int xdp_wg_proxy(struct iphdr *ip, struct udphdr *udp) {
if (!read_port_settings()){ if (!read_port_settings()){
return XDP_PASS; 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 // 2130706433 = 127.0.0.1