Skip to content

Complete gateway and NAT forwarding for both transport modes #1403

Done

Description

@privateip

Parent: #1399

Dependencies

Deliverable

Gateway and NAT XDP paths that classify and transmit correctly across independently configurable public-side and fabric-side tagged/untagged transport in each required attach mode.

Work items

  • Implement independent public-facing and fabric-facing interface/tag context for gateway and NAT. Public ingress uses the configured external-router adjacency; gateway encapsulation and NAT return select fabric context; DSR return and NAT outbound select public context. Never reuse an ingress VLAN ID as the egress VLAN ID without resolving the destination segment.
  • Support public-side IPv4/IPv6 ARP/ND and routing control traffic through the intended host-stack path. Verify logical/public VLAN interface versus physical hook selection, FIB/neighbor scope, mode-specific tag handling, and cold-neighbor fallback independently on each side.
  • Consume or derive the configured transport mode, logical interface, parent, and VLAN context consistently with TC and infrastructure provisioning. Support operator-selected IDs/parents and no-VLAN operation without a hard-coded tag or a required VLAN netdevice.
  • Resolve measured classification and packet-layout gaps in gateway ingress/return and NAT leaves, including offsets through encapsulation/translation and the contract's supported tag representations.
  • Implement the chosen egress strategy for FIB-selected VLAN adjacency, actual transmit device, MAC/neighbor resolution, and exactly one configured tag in tagged mode or no transport tag in untagged mode. Cover direct forwarding and host-stack continuation, including NAT return neighbor fallback and gateway fallback where applicable.
  • Verify direct and shared-dispatch operation where supported. Preserve unclaimed packets and slot continuation; keep the dispatcher free of packet parsing unless a separately justified design change is approved. Enforce the defined transport-context claim policy.

Acceptance

Lab checks deferred. Under #1399's 2026-11-30 decision, this PR carries unit tests and real-kernel root tests. Every check below that needs the shared containerlab lab runs in #1405's end-of-epic lab pass instead, and is not a merge gate here.

  • All four public/fabric mode combinations pass gateway requests from an external client (including same-node delivery if Define configurable tagged and untagged transport contracts #1400 requires it), backend DSR replies to that client, and NAT66/NAT64 public outbound and return traffic, including different IDs for tagged/tagged and cold/warm neighbors. Captures on each link prove correct independent tags without cross-side leakage.
  • Unclaimed public control traffic remains available to the host stack, and wrong public/fabric VLANs do not bypass the defined claim/isolation rules. Direct and shared-dispatch paths retain the correct per-side context without requiring packet parsing in the dispatcher.
  • Execute every required gateway/DSR/NAT direction in both modes, with at least two configured VLAN IDs and two VLANs sharing a parent. Untagged cases require no VLAN device/ID. Wire observations prove mode-specific tag behavior and configured-context isolation through direct transmission, dispatcher continuation, and host-stack fallback.
  • Gateway ingress, backend DSR replies, NAT66, and NAT64 pass end to end for their supported families, using cold/warm neighbors and each required native/generic mode.
  • Captures prove correct tags and payloads at actual transmission and receipt. Asynchronous redirect failures and unsupported transmit targets are observable; successful helper return alone is not a pass.
  • Shared-hook gateway/NAT tests prove unclaimed and unrelated traffic reaches the intended next slot or host stack without corruption, double tagging, or cross-VLAN claims. Negative observations include possible unintended tenant destinations.
  • The delivering PR carries real-kernel and lab regression results, relevant mandatory checks, and compatibility/rollback notes; it makes no unexecuted hardware qualification claim.

Activity

  1. added theissue type on Nov 14, 2026
  2. changed the title [-]Complete gateway and NAT forwarding over VLAN transport[/-] [+]Complete gateway and NAT forwarding for both transport modes[/+] on Nov 14, 2026
  3. self-assigned this
    on Nov 30, 2026
  4. privateip commented on Nov 30, 2026

    @privateip
    ContributorAuthor

    Starting implementation on feat/issue-1403, based on epic/1399-vlan-transport (which now includes #1536).

    Design (agreed with the epic coordinator):

    • Hook placement. A tagged side's XDP hooks attach to its VLAN netdevice, always in generic mode. The kernel has already demultiplexed by VLAN ID before generic XDP runs there, so the isolation is exact whatever the VLAN receive offload, the driver or the bond. The programs don't parse tags, and the dispatcher stays free of packet parsing. Every other interface keeps the host mode (GALACTIC_XDP_MODE / xdpmode). The dispatcher and xdpattach resolve the mode per interface, and the host-wide claim is unchanged.
    • Egress. edgedsr.c and nat.c each get a vlan_egress map, VLAN ifindex to lower ifindex and VID, filled from netlink for the configured sides' logical interfaces. When bpf_fib_lookup returns a mapped VLAN netdevice, the program pushes exactly one 802.1Q tag and redirects to the lower device, or uses XDP_TX when the lower device is the ingress. A native redirect to the VLAN netdevice, which drops every frame (Characterize tagged and untagged TC and XDP forwarding #1401 Q4), never happens.
    • Fallbacks. The neighbour-miss fallback, same-node delivery and unclaimed XDP_PASS stay in the VLAN context, because the hook runs on the VLAN netdevice.
    • Not supported. An untagged side sharing a parent with the other side's VLAN (contract Q8). Native hooks on that parent see metadata-tagged frames as untagged.

    Tests. Unit tests for target and map resolution. Real-kernel root tests in both GALACTIC_XDP_MODE=native and generic:

    • isolation between two VLANs on one parent;
    • exactly one tag on the redirect to the lower device and on XDP_TX;
    • the XDP_PASS fallback staying in the VLAN context.

    Lab rows are deferred to #1405.

    Docs. Contract §6, §8 and §10, and docs/operations/xdp-attach-mode.md.

  5. privateip commented on Nov 30, 2026

    @privateip
    ContributorAuthor

    Delivered by #1540, merged into the epic branch epic/1399-vlan-transport as 705dede. A tagged side's gateway and NAT XDP hooks run generic on its VLAN netdevice, so the kernel separates VLANs before XDP runs. vlan_egress pushes exactly one 802.1Q tag and redirects to the lower device. CI's root job passed the new tests across all four public/fabric combinations, in both host modes, covering gateway ingress, DSR return, NAT66 and NAT64, isolation from other VLANs, cold-neighbour fallback and same-node delivery. #1539 adds the combined usid_ingress claim check for same-node delivery. Lab rows run in #1405. Closed by hand because Fixes only fires when the epic branch merges into main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions