Files
netbird/client/internal/ebpf/ebpf/src/readme.md
Zoltan Papp f89332fcd2 Update port, ip choice logic in DNS service (#1514)
Ensure we use WG address instead of loopback addresses for eBPF.
- First try to use 53 port
- Try to use 5053 port on WG interface for eBPF
- Try to use 5053 on WG interface or loopback interface
2024-02-02 17:53:55 +01:00

701 B

DNS forwarder

The agent attach the XDP program to the lo device. We can not use fake address in eBPF because the traffic does not appear in the eBPF program. The program capture the traffic on wg_ip:53 and overwrite in it the destination port to 5053.

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