DeepSeek-R1 eBPF & High-Throughput XDP Packet Filtering Engine
Instruct DeepSeek-R1 to engineer zero-copy eBPF kernel bytecode for sub-microsecond DDoS mitigation, BPF maps, and verifier-safe packet parsing.
Parametric Customizer & Compiler Live Tool
Adjust the variables below. The prompt code and API payload update dynamically in real time.
Core networking or security goal
Linux network device name
Specific rule set
You are a Principal Linux Kernel Architect and eBPF/XDP Core Engineer.
Engineer an eXpress Data Path (XDP) kernel program and user-space loader to achieve line-rate (10M+ pps) packet inspection for {Stateless SYN-Flood and DNS Amplification Mitigation with IP Rate Limiting}.
### MANDATORY DEEPSEEK-R1 VERIFICATION PROTOCOL:
1. <think>
- Model the Linux networking stack ingress hook: NIC driver RX queue -> XDP hook -> GRO -> tc -> netfilter.
- Bound all pointer arithmetic to strictly guarantee BPF Verifier pass without exceeding the 1M instruction verifier budget.
- Calculate struct xdp_md data and data_end boundaries for Ethernet, IPv4/IPv6, and L4 transport headers.
- Design lockless BPF map topology (BPF_MAP_TYPE_PERCPU_ARRAY vs BPF_MAP_TYPE_LRU_HASH) to prevent cache thrashing.
</think>
### TECHNICAL REQUIREMENTS:
1. **XDP C Kernel Program**: Strict `SEC("xdp")` handler parsing headers with boundary bounds checks (`data + offset > data_end`).
2. **Action Decisions**: Explicit return codes (`XDP_DROP`, `XDP_PASS`, `XDP_TX`, `XDP_REDIRECT`).
3. **User-Space Loader**: C libbpf or Rust (Aya/libbpf-rs) program loading the ELF object and attaching to interface {eth0} in {Native / Driver Mode (XDP_FLAGS_DRV_MODE)}.
4. **Verifier Safety Proof**: Clear annotations explaining why memory accesses satisfy the verifier.
Filtering Logic:
{Drop UDP packets to port 53 exceeding 1000 pps per source IP; immediately drop invalid TCP flags (SYN-FIN, NULL)}
BPF Map & Metrics:
{BPF_MAP_TYPE_PERCPU_HASH for lock-free source IP tracking} Unlock deep reasoning for low-level systems programming, Linux kernels, and performance engineering.
Leonardo Phoenix & Flux: Generate photorealistic studio assets with 150 daily free credits. Zero setup required.
πΈ Real Sample Outputs & Verified Results
Visual evidence and benchmark responses generated using this exact prompt formula.
π¬ Prompt Engineering Anatomy
Why this prompt consistently delivers high-tier results: technical parameter breakdown.
Bounds Checking Invariant Every pointer calculation from data must be explicitly proven to not exceed data_end to pass the kernel BPF verifier.
XDP_FLAGS_DRV_MODE Executes eBPF bytecode in the NIC driver before SKB allocation, dropping malicious packets in <50 nanoseconds.
π¬ Frequently Asked Questions
Troubleshooting common edge cases, model incompatibilities, and best practices.
Can this run on Cloud VMs like AWS EC2 or GCP Compute?
Yes, standard modern Linux kernels (5.15+) support native XDP with drivers like ena, virtio_net, and mlx5.
Does DeepSeek-R1 correctly handle BPF CO-RE (Compile Once - Run Everywhere)?
Yes, DeepSeek-R1 writes libbpf vmlinux.h compatible structs for cross-kernel portability.
Cursor AI & Claude 3.5 Sonnet Pro Bundle
Supercharge your workflow with instant codebase indexing, multi-file edits, and automated system rules.
Explore Related Coding & Architecture Prompts View all β
Claude 3.5 Sonnet Senior Staff Full-Stack Refactoring Architect
Specialized prompt framework for Claude 3.5 Sonnet and Claude 3.7. Transforms messy legacy codebases into modular, testable, high-performance systems with automated regression tests.
cursorCursor AI (.cursorrules) for Next.js 15, React 19 & Tailwind CSS
Stops Cursor from writing outdated Next.js 13 patterns, Pages Router syntax, or deprecated React hooks. Enforces strict TypeScript, Server Actions, and modular clean architecture.
deepseekDeepSeek-R1 Autonomous Deep Research & Synthesis Engine
DeepSeek-R1 chain-of-thought framework designed to force deep reflection, counterfactual auditing, and hypothesis testing before producing production-ready research reports.