Solnix is a systems programming language designed specifically for eBPF (extended Berkeley Packet Filter) program development. It provides a high-level syntax for writing eBPF programs while generating efficient C code compatible with the libbpf ecosystem.
- eBPF-Specific Syntax: Purpose-built constructs for common eBPF patterns
- Type Safety: Static typing with eBPF-aware type checking
- libbpf Integration: Generates C code compatible with libbpf and vmlinux.h
Solnix aims to simplify eBPF development by providing a more accessible syntax than raw C while maintaining compatibility with the established libbpf ecosystem. The compiler generates standard eBPF C code that can be compiled with clang and loaded using standard Linux tools.
Solnix is implemented in Rust and consists of three main repositories:
- solnix-compiler: Core compiler implementation with lexer, parser, semantic analysis, and C code generation
- solnix-cli: Command-line interface and build tooling
- solnix-docs: Language specification and architectural documentation
- Rust 1.70+ with Cargo
- Clang 11+ with BPF target support
- Linux kernel 4.18+ with eBPF support
- libbpf development headers (for vmlinux.h)
# Compile a Solnix program
solnix build program.snx
# Load into kernel (XDP example)
sudo ip link set dev eth0 xdp obj program.omap packet_counter {
type: .hash;
key: u32;
value: u64;
max: 1024;
}
unit xdp_filter {
section: "xdp";
license: "GPL";
reg src_ip = ctx.load_u32(26);
heap count_ptr = packet_counter.lookup(src_ip);
if guard(count_ptr) {
*count_ptr += 1;
}
return 1;
}
Solnix is in early development with a working compiler that generates libbpf-compatible C code.
Contributions are welcome. Please refer to the architecture documentation for implementation details and design rationale.