Your veth setup, with xdp_client at 10.10.0.2 and xdp_server at 10.10.0.1, gives a clear first check of the rule and STATS_MAP wiring. I would keep the 100% drop observation scoped to that testbed, then report the XDP mode, kernel version, NIC, packet size, and traffic rate before treating it as a line-rate result on hardware. How did the next test change when you moved from the veth pair to a physical interface?
Building a Line-Rate Linux Kernel Firewall in Pure Rust with Aya and eBPF/XDP
10 Comments
@[Mike Dabydeen]
@Mike Dabydeen Spot-on analysis, thank you for the sharp feedback.
You hit the core issue directly: handing out 999 tokens on the None insertion path turns a spoofed/randomized-IP flood into a near 100% pass-through, while the 131k LRU churn (~9 ms at 14.88 Mpps) evicts legitimate flows and hands them fresh quotas repeatedly.
Here is what I'm rolling out to address this and tighten the pipeline:
- Benchmark Reporting: Adding packet pass/drop ratios under uniform pseudo-random source floods alongside line-rate Mpps and table occupancy, so the benchmark reflects true filtering effectiveness.
- Two-Tier Limiting: Introducing a coarser subnet/prefix bucket (e.g. /24 aggregation) before the per-IP bucket, plus a shared global/per-CPU admission bucket for unknown-source allocations to throttle spoofed floods regardless of source address churn.
- Telemetry & Concurrency Tuning: Moving the global
STATS_MAPto aPerCpuArrayto eliminate multicore cache-line bouncing at line-rate, and handling residual fractional nanoseconds on token refills (last_update_ns += tokens * refill_ns) to prevent drift.
Really appreciate you taking the time to review the architecture so thoroughly!
@[rahadbhuiya] Of those two, the unknown-source budget is the one that bounds a uniformly random flood, and I'd build it first. I undersold that in my last comment. A /24 bucket has the same churn problem as the per-IP one: random IPv4 sources spread across about 16.7 million /24 prefixes, so nearly every packet still arrives with a new key and a fresh bucket in a 131k map.
The prefix tier earns its place when the spoofing stays inside a few ranges, or when one network sends a lot of real traffic. The per-CPU budget for sources with no entry yet is the limit that holds however the addresses are spread, so it's the one the random-flood benchmark should prove.
@[Mike Dabydeen]
That math on the ~16.7M /24 prefixes is precisely why I ended up treating the admission bucket as the actual gatekeeper rather than relying on prefix hashing alone.
In the implementation, before an unseen flow even touches the LRU map or allocates a bucket, it must draw from that shared ingress admission budget. Under a uniformly distributed spoofed flood, that admission pool drains almost instantly, and subsequent unseen packets are dropped at wire-speed before they can cause LRU eviction churn. The /24 aggregation acts merely as a localized safeguard for concentrated bursts.
Really appreciate you calling out the per-CPU budget focus for the random-flood benchmark. I'm structuring the synthetic flood benchmarks specifically to highlight admission budget exhaustion vs LRU churn.
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
Specializing in low-level Linux kernel development, eBPF line-rate networking, zero-heap #![no_std] Rust architectures, and aerospace flight software integration.
Track Record & Upstream Impact: • 17 Officially Merged Upstream Patches across foundational ecosystems:
Linux Kernel 7.4 (sched_ext task lifecycle cleanup)
Linux NVMe (11 PRs merged across core memory safety & enterprise vendor mock test suites)
NASA F Prime flight software (CFDP 1-bit protocol closure & subtopology builds)
Microsoft VS Code CLI (portable environment isolation)
Subsurface dive models (regression test harness & query engines)
Flagship Platforms @ Exploidus: • Aegis-Filter: 4.07 ns zero-heap Kalman filtering for aerospace/UAV GNC with Joseph-form stability & FDIR anomaly rejection. • XDP-Guard: Wire-speed 100 Gbps ingress DDoS mitigation directly at the NIC driver DMA ring. • Sovereign Flight Infrastructure: Native NASA cFS port with BLAKE3 capability-gated software bus and the scx_intent deterministic kernel scheduler.
Open to collaborating with aerospace contractors, defense UAV manufacturers, and systems engineers.
Direct inquiry: rahadbhuiya2021@gmail.com | Architecture: https://exploidus.com Show less
More From rahadbhuiya
Related Jobs
- DevOps Engineer III: Linux / AutomationJack Henry & Associates · Full time · Springfield, MO
- Rust Full Stack DeveloperPerennial Resources International · Full time · Charlotte, NC
- ASOCIADO DE SHIPPING BAYAMN PMPan Pepin · Full time · Puerto Rico
Commenters (This Week)
Contribute meaningful comments to climb the leaderboard and earn badges!