How murilochianfa/srv6-pot-tlv works
Project type and purpose
• This is a specialized network-function project that implements an eBPF-based Proof-of-Transit TLV mechanism for SRv6.
• It comprises three “planes”:
a. Data Plane: eBPF bytecode attached at XDP and TC hooks in the Linux kernel.
b. Control Plane: A Go-based CLI (cmd/main.go) that loads/unloads BPF programs, pins and updates key maps, and interacts with the kernel’s BPF subsystem.
c. Deployment/Orchestration Plane: An Ansible/QEMU-based topology under topology/ to spin up SRv6 routers and hosts, plus Python scripts under tests/ to evaluate performance.
File structure
• bpf/ – contains eBPF C headers and source (seg6-pot-tlv.bpf.c at root) implementing:
• Crypto primitives (SipHash, Poly1305, BLAKE3)
• SRv6 header parsing (hdr.h, srh.h, tlv.h)
• PoT TLV operations (pot/add.h, pot/update.h, pot/remove.h)
• cmd/ – Go CLI using libbpf to: load programs into XDP/TC, pin maps, and manage SID→key entries.
• topology/ – Ansible inventories and playbooks, shell scripts, and cloud-init metadata to build a multi-node SRv6 domain in QEMU VMs.
• tests/ – Python scripts and data for gathering RTT, plotting results, and debug TRACING.
README for additional insights
• The README describes the SRv6 packet format, the TLV layout, usage of the CLI tool, debugging commands (bpftool, tcpdump), and end-to-end demonstration with QEMU topology.
• It clarifies the three crypto algorithms and the phases: compile BPF bytecode, load via CLI, update key map, generate traffic, and verify PoT in the TLV.
a. User-Space CLI (Go binary “seg6-pot-tlv”)
b. Kernel eBPF Subsystem:
• XDP Program (pre-routing)
• TC BPF Program (ingress qdisc)
• BPF Maps (SID→Key store)
c. Linux Kernel Networking Stack – SRv6 packet handling
d. Virtual Network Topology (Hosts H1/H2 and Routers R1…R4)
e. Test Harness & Orchestration:
• Ansible + QEMU for deployment
• Python scripts for performance measurement
f. External Tools & Interfaces:
• bpftool, tcpdump/tshark for debugging
• iproute2 for SRv6 route configuration
Relationships & Data Flows:
• The CLI invokes netlink/libbpf to load XDP+TC programs into the kernel on a target interface.
• The CLI populates BPF maps (pinned under /sys/fs/bpf/…) with SID→32B keys.
• Incoming SRv6 packets hit the XDP hook → TLV is parsed/updated (crypto is invoked).
• Packets pass to the kernel’s SRv6 processing → forwarded to next hop → possibly hit TC hook on egress for final TLV update or verification.
• Debug tools tap kernel logs and packet streams.
• Ansible orchestrates VM creation, network links, and auto-loads the CLI on each router.
• Tests generate traffic from H1→H2 and collect end-to-end RTT or TLV contents.
Architectural Patterns & Design Principles
• Clear separation of Control Plane (Go CLI) vs Data Plane (eBPF code).
• Use of BPF maps as shared, pinned key-value stores.
• Modular BPF code: distinct headers for parsing SRH, TLV, crypto, and PoT operations.
• CO-RE style eBPF for portability across kernel versions (libbpf).
• Infrastructure-as-code (Ansible + QEMU) for reproducible deployments.