This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: cilium-ebpf-big-tcp-ipv6-extension-header-mtu-boundary

Cilium eBPF BIG TCP with IPv6 Extension Header MTU Boundary Enforcement

Enabling IPv6 BIG TCP across 100GbE+ fabrics increases GRO/GSO limits up to 194KB per super-packet, making silent packet truncation catastrophic. All Cilium eBPF tail programs and BPF-to-BPF functions handling IPv6 packets must account for cumulative IPv6 extension header chains (HBH, Routing, Fragment, DSR) before validating against the hardware interface GSO maximum and L2 MTU limits. Failure to accurately compute effective payload boundaries leads to silent hardware ring-buffer drops or invalid unfragmentable egress packet states.

Prohibited Anti-Pattern: Hardcoded Base MTU Offsets and Incomplete IPv6 Extension Header Length Accounting in Super-Packet Pipelines

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF BIG TCP with IPv6 Extension Header MTU Boundary Enforcement - Enabling IPv6 BIG TCP across 100GbE+ fabrics increases GRO/GSO limits up to 194KB per super-packet, making silent packet truncation catastrophic. All Cilium eBPF tail programs and BPF-to-BPF functions handling IPv6 packets must account for cumulative IPv6 extension header chains (HBH, Routing, Fragment, DSR) before validating against the hardware interface GSO maximum and L2 MTU limits. Failure to accurately compute effective payload boundaries leads to silent hardware ring-buffer drops or invalid unfragmentable egress packet states.
globs: bpf/**/*.c, bpf/**/*.h, pkg/datapath/**/*.go, pkg/ebpf/**/*.go, deploy/cilium-values.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-big-tcp-ipv6-extension-header-mtu-boundary"
---

# Cilium eBPF BIG TCP with IPv6 Extension Header MTU Boundary Enforcement

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Hardcoded Base MTU Offsets and Incomplete IPv6 Extension Header Length Accounting in Super-Packet Pipelines

## System Constraints
You are a Principal Systems Engineer and Kernel Datapath Architect enforcing the Cilium eBPF BIG TCP with IPv6 Extension Header MTU Boundary Standard. You must mandate strict accounting for dynamic IPv6 Extension Header lengths prior to MTU enforcement or tail calls in GRO/GSO super-packet pipelines. Ensure eBPF verifier compliance using bounded loop constructs and eliminate silent drops or packet corruption on 100GbE+ fabrics.

## Strict Guidelines
- Engineers MUST ALWAYS compute the full dynamic length of IPv6 extension header chains (including Hop-by-Hop, Routing, Destination Options, and Segment Routing SRv6) before calculating MTU headroom or comparing against skb->len in BIG TCP enabled nodes.
- Engineers MUST NOT assume an IPv6 packet header is exactly 40 bytes (sizeof(struct ipv6hdr)) when evaluating maximum transmission boundaries for GSO super-packets exceeding standard 64KB buffers.
- eBPF parsers MUST use verifier-compliant bounded iterations (e.g., #pragma unroll or bounded loops limited to max 8 headers) with explicit `data + offset <= data_end` boundary validations on every extension header step.
- Datapath code MUST explicitly trigger ICMPv6 Packet Too Big (PTB, Type 2, Code 0) generation with the calculated MTU when an unfragmentable super-packet or transit frame exceeds the L2 device MTU or path MTU ceiling.
- Control plane configurations MUST ensure `enable-ipv6-big-tcp: true` is coupled with consistent MTU settings across `cilium-config` and parent node network interfaces (e.g., device MTU matching physical interface MTU without tail-fragmentation assumptions).

## Bad vs Good Implementations
### Cilium eBPF Datapath: Safe IPv6 Extension Header Traversal for BIG TCP MTU Validation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The code assumes the IPv6 header is static (40 bytes) and drops or miscalculates any super-packet carrying IPv6 extension headers. Under BIG TCP (up to 194KB GSO), extension headers like SRv6 or Hop-by-Hop options push the inner payload offset, leading to incorrect MTU clamping, verifier out-of-bounds access, or silent hardware drops.
```c
// ANTI-PATTERN: Blindly assuming fixed 40-byte IPv6 header on 194KB BIG TCP super-packets
#include <linux/bpf.h>
#include <linux/ipv6.h>
#include <bpf/bpf_helpers.h>

SEC("tc")
int cilium_check_mtu(struct __sk_buff *skb) {
    void *data = (void *)(long)skb->data;
    void *data_end = (void *)(long)skb->data_end;
    struct ipv6hdr *ip6 = data;

    if ((void *)(ip6 + 1) > data_end)
        return TC_ACT_SHOT;

    // WRONG: Ignores IPv6 extension headers (SRv6, Hop-by-Hop, DSR)!
    // Super-packet payload calculation is off, resulting in silent ring buffer drop
    __u32 l4_payload_len = skb->len - sizeof(struct ipv6hdr);
    if (l4_payload_len > 65535) {
        // Unsafe assumption that BIG TCP packets cannot carry chained ext headers
        return TC_ACT_SHOT;
    }

    return TC_ACT_OK;
}
```

#### Production Standard (Correct)
> **Standard**: Iterates through the IPv6 extension header chain using a compiler-unrolled bounded loop. Every extension length is verifier-checked against `data_end`. The total MTU and GSO budget are validated using the exact dynamic header offset, preventing silent drops on 100GbE+ interfaces running IPv6 BIG TCP.
```c
// PRODUCTION STANDARD: Bounded traversal of IPv6 extension headers for BIG TCP MTU bounds
#include <linux/bpf.h>
#include <linux/ipv6.h>
#include <bpf/bpf_helpers.h>

#define MAX_EXT_HEADERS 6
#define BIG_TCP_MAX_GSO_SIZE 198608 // 194KB maximum GRO/GSO threshold

SEC("tc")
int cilium_check_mtu(struct __sk_buff *skb) {
    void *data = (void *)(long)skb->data;
    void *data_end = (void *)(long)skb->data_end;
    struct ipv6hdr *ip6 = data;

    if ((void *)(ip6 + 1) > data_end)
        return TC_ACT_SHOT;

    __u16 offset = sizeof(struct ipv6hdr);
    __u8 nexthdr = ip6->nexthdr;

    #pragma unroll
    for (int i = 0; i < MAX_EXT_HEADERS; i++) {
        if (nexthdr != NEXTHDR_HOP && nexthdr != NEXTHDR_ROUTING &&
            nexthdr != NEXTHDR_DEST && nexthdr != NEXTHDR_AUTH)
            break;

        struct ipv6_opt_hdr *opt = (void *)data + offset;
        if ((void *)(opt + 1) > data_end)
            return TC_ACT_SHOT;

        __u16 hdrlen = (opt->hdrlen + 1) << 3;
        offset += hdrlen;
        nexthdr = opt->nexthdr;

        if ((void *)data + offset > data_end)
            return TC_ACT_SHOT;
    }

    // Validate exact super-packet payload against BIG TCP boundary
    if (skb->len > BIG_TCP_MAX_GSO_SIZE + offset)
        return TC_ACT_SHOT;

    return TC_ACT_OK;
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cilium eBPF BIG TCP with IPv6 Extension Header MTU Boundary Enforcement

Cilium eBPF BIG TCP with IPv6 Extension Header MTU Boundary Enforcement defines an industrial-grade behavioral standard for devops engineering. Enabling IPv6 BIG TCP across 100GbE+ fabrics increases GRO/GSO limits up to 194KB per super-packet, making silent packet truncation catastrophic. All Cilium eBPF tail programs and BPF-to-BPF functions handling IPv6 packets must account for cumulative IPv6 extension header chains (HBH, Routing, Fragment, DSR) before validating against the hardware interface GSO maximum and L2 MTU limits. Failure to accurately compute effective payload boundaries leads to silent hardware ring-buffer drops or invalid unfragmentable egress packet states. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Hardcoded Base MTU Offsets and Incomplete IPv6 Extension Header Length Accounting in Super-Packet Pipelines Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

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 ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftHardcoded Base MTU Offsets and Incomplete IPv6 Extension Header Length Accounting in Super-Packet PipelinesCritical
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 InconsistencyAI 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.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS compute the full dynamic length of IPv6 extension header chains (including Hop-by-Hop, Routing, Destination Options, and Segment Routing SRv6) before calculating MTU headroom or comparing against skb->len in BIG TCP enabled nodes.

Engineers MUST ALWAYS compute the full dynamic length of IPv6 extension header chains (including Hop-by-Hop, Routing, Destination Options, and Segment Routing SRv6) before calculating MTU headroom or comparing against skb->len in BIG TCP enabled nodes.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT assume an IPv6 packet header is exactly 40 bytes (sizeof(struct ipv6hdr)) when evaluating maximum transmission boundaries for GSO super-packets exceeding standard 64KB buffers.

Engineers MUST NOT assume an IPv6 packet header is exactly 40 bytes (sizeof(struct ipv6hdr)) when evaluating maximum transmission boundaries for GSO super-packets exceeding standard 64KB buffers.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

eBPF parsers MUST use verifier-compliant bounded iterations (e.g., #pragma unroll or bounded loops limited to max 8 headers) with explicit `data + offset <= data_end` boundary validations on every extension header step.

eBPF parsers MUST use verifier-compliant bounded iterations (e.g., #pragma unroll or bounded loops limited to max 8 headers) with explicit `data + offset <= data_end` boundary validations on every extension header step.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Datapath code MUST explicitly trigger ICMPv6 Packet Too Big (PTB, Type 2, Code 0) generation with the calculated MTU when an unfragmentable super-packet or transit frame exceeds the L2 device MTU or path MTU ceiling.

Datapath code MUST explicitly trigger ICMPv6 Packet Too Big (PTB, Type 2, Code 0) generation with the calculated MTU when an unfragmentable super-packet or transit frame exceeds the L2 device MTU or path MTU ceiling.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Control plane configurations MUST ensure `enable-ipv6-big-tcp

Control plane configurations MUST ensure `enable-ipv6-big-tcp: true` is coupled with consistent MTU settings across `cilium-config` and parent node network interfaces (e.g., device MTU matching physical interface MTU without tail-fragmentation assumptions).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Cilium eBPF BIG TCP with IPv6 Extension Header MTU Boundary Enforcement critical for AI coding assistants?

Enabling IPv6 BIG TCP across 100GbE+ fabrics increases GRO/GSO limits up to 194KB per super-packet, making silent packet truncation catastrophic. All Cilium eBPF tail programs and BPF-to-BPF functions handling IPv6 packets must account for cumulative IPv6 extension header chains (HBH, Routing, Fragment, DSR) before validating against the hardware interface GSO maximum and L2 MTU limits. Failure to accurately compute effective payload boundaries leads to silent hardware ring-buffer drops or invalid unfragmentable egress packet states. 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 (Hardcoded Base MTU Offsets and Incomplete IPv6 Extension Header Length Accounting in Super-Packet Pipelines) 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.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Cilium