netxfw is a high-performance, programmable firewall built on eBPF (Extended Berkeley Packet Filter) and XDP (eXpress Data Path). It operates at the earliest possible point in the Linux networking stack (the driver hook), allowing it to drop or redirect packets with minimal CPU overhead before they reach the kernel’s networking stack (sk_buff allocation).
The data plane is written in C and compiled into BPF bytecode. It runs directly in the kernel.
bpf/::ffff:a.b.c.d).XDP_DROP (Block), XDP_PASS (Allow), and XDP_TX (Bounce - planned).The control plane is written in Go and runs in user space. It manages the lifecycle of the BPF programs and interacts with BPF maps.
cmd/netxfw, internal/cilium/ebpf and pins Maps to /sys/fs/bpf/netxfw_v2.rules.deny.txt and config.yaml.netxfw rule add, netxfw system top).To simplify maintenance and reduce memory usage, netxfw uses a unified Map strategy:
lock_list (LPM Trie)struct lpm_key (128-bit IPv6 address + prefix length)192.0.2.1::ffff:192.0.2.1bpf/: eBPF source code (.c) and headers.cmd/netxfw/: Main entry point for the Go binary.internal/core/: Business logic for rule management.internal/xdp/: Low-level BPF interaction (loading, Map wrappers).rules/: Default configuration files.test/: Integration and unit tests.filter.bpf.c parses Ethernet -> IP (v4/v6) -> L4 headers.whitelist (Allow).lock_list (Block).ip_port_rules (Fine-grained).XDP_DROP + Increment drop counter.XDP_PASS (Continue to kernel stack)./sys/fs/bpf/netxfw_v2/* (Pinned BPF Maps).rules.deny.txt (Plain text list) & config.yaml.netxfw system sync command handles bidirectional sync between runtime state and storage.