Architectural Invariant Design: eBPF TC Ingress Dynamic MSS Clamping Production Standard
eBPF TC Ingress Dynamic MSS Clamping Production Standard defines an industrial-grade behavioral standard for devops engineering. Enforces deterministic TCP Maximum Segment Size (MSS) clamping at the eBPF Traffic Control (TC) ingress hook prior to tunnel encapsulation. Prevents silent Path MTU Discovery (PMTUD) blackholing across hybrid cloud overlay topologies by rewriting TCP Option 2 on SYN/SYN-ACK segments and incrementally updating Layer 4 checksums. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.
Hazard Analysis: What Breaks Without This Rule
The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:
| Failure Mode | AI Symptom (The Anti-Pattern) | Severity | Production Impact & Remedy |
|---|---|---|---|
| AI Hallucination & Deprecation Drift | Static MTU assumptions, missing TCP checksum incremental updates, or omitting BPF verifier pointer re-validations during option rewriting. | Critical | Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production. Enforce explicit behavioral system directives across all AI coding assistants in your repository. |
| Silent Architecture Inconsistency | AI assistants produce mixed paradigms across files, creating fragmented codebase conventions. | Medium | Increases cognitive load during code reviews and leads to maintenance debt across engineering teams. Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails. |
Step-by-Step Production Directives
Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:
Engineers MUST ALWAYS filter for TCP SYN or SYN-ACK packets before parsing TCP options, instantly returning TC_ACT_OK for established data traffic.
Engineers MUST ALWAYS filter for TCP SYN or SYN-ACK packets before parsing TCP options, instantly returning TC_ACT_OK for established data traffic.
Engineers MUST ALWAYS re-validate packet bounds pointers (`data`, `data_end`) after invoking any BPF helper function that mutates skb length or header layout.
Engineers MUST ALWAYS re-validate packet bounds pointers (`data`, `data_end`) after invoking any BPF helper function that mutates skb length or header layout.
Engineers MUST ALWAYS parse TCP options using bounded loops with `#pragma unroll` to satisfy the BPF verifier's termination analysis.
Engineers MUST ALWAYS parse TCP options using bounded loops with `#pragma unroll` to satisfy the BPF verifier's termination analysis.
Engineers MUST update the TCP checksum incrementally using `bpf_l4_csum_replace()` with `BPF_F_PSEUDO_HDR` whenever the MSS option value is modified.
Engineers MUST update the TCP checksum incrementally using `bpf_l4_csum_replace()` with `BPF_F_PSEUDO_HDR` whenever the MSS option value is modified.
Engineers MUST NOT hardcode MSS option offsets
Engineers MUST NOT hardcode MSS option offsets; options MUST be discovered via RFC 793 TLV iteration up to `doff * 4` bytes.
Engineers MUST NOT clamp MSS upwards
Engineers MUST NOT clamp MSS upwards; clamping MUST only decrease the advertised MSS when it exceeds the dynamic link path budget (`Target_MSS = Tunnel_MTU - IP_Header - TCP_Header`).
Services MUST query encapsulation overhead dynamically from a synchronized BPF map keyed by destination egress subnet or overlay tunnel device type.
Services MUST query encapsulation overhead dynamically from a synchronized BPF map keyed by destination egress subnet or overlay tunnel device type.
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is eBPF TC Ingress Dynamic MSS Clamping Production Standard critical for AI coding assistants?
Enforces deterministic TCP Maximum Segment Size (MSS) clamping at the eBPF Traffic Control (TC) ingress hook prior to tunnel encapsulation. Prevents silent Path MTU Discovery (PMTUD) blackholing across hybrid cloud overlay topologies by rewriting TCP Option 2 on SYN/SYN-ACK segments and incrementally updating Layer 4 checksums. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.
Q:How does adopting this rule prevent AI hallucinations?
This rule explicitly declares what the AI must avoid (Static MTU assumptions, missing TCP checksum incremental updates, or omitting BPF verifier pointer re-validations during option rewriting.) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.
Q:Which AI coding environments are supported?
This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).
Q:Can I combine this rule with other technology stacks?
Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.