Skip to content

Edge public listener replies are dropped on edge nodes with no tenant pods #1544

Description

@privateip

Summary

An Edge public listener whose backends all run on gateway nodes reports itself ready but never completes a connection. Clients reach the provider, and the node drops every reply the provider sends.

This blocks MASQUE through a public listener in any cell where every edge node also runs a gateway, which is the case gateway local delivery was added for in #1527.

The node never learns where to send listener replies, because only tenant pod setup and the repair pass that follows tenant attachments record its uplink, so an edge node whose only attachment is a listener's never gets one.

Acceptance criteria

  • A client completes TCP and QUIC handshakes over IPv4 and IPv6 with a listener backend on an edge node that hosts no tenant attachment
  • The containerlab listener test covers a backend on a gateway node with local delivery on, as feat(gateway): Deliver load-balanced flows to a backend on the same node #1527's open test-plan item asks
  • A listener reply dropped because the node has no recorded uplink is counted apart from one with no matching VIP translation

Activity

  1. added
    galactic-cni
    galactic-edge
    bug
    on Nov 30, 2026
  2. privateip commented on Nov 30, 2026

    @privateip
    ContributorAuthor

    Evidence, from a cell where every edge node runs a gateway with GALACTIC_GATEWAY_LOCAL_DELIVERY=true, and one masque-provider pod on node-a serves the public-listener component.

    Control plane is all green. Every NetworkGateway reports status.localDelivery: true. EdgeListener masque-public is Programmed (BackendsReady, 1 of 1 attachments serving), its two NetworkServices are Ready, and the four ServiceVIPBindings on node-a are Bound. A TCP connect or HTTP/3 request to 192.0.2.10:443 or [2001:db8::10]:443 times out.

    Counters on node-a across five TCP connects to the IPv4 VIP:

    Counter Change
    galactic_edge_rule_packets_total, listener TCP 443 rule +10
    galactic_edge_local_deliveries_total +10
    galactic_edge_drops_total none
    traffic policy ingress allow-listener on the listener attachment rising
    traffic policy egress allow-listener-replies 0
    galactic_usid_drops_total{reason="listener_unmatched_egress"} rising, matched by egress galactic_usid_vrf_dropped_packets_total on the ingress gVPC's VRF

    Maps on node-a, read from a galactic-debug node pod:

    • edge_listener_link_table holds the listener attachment's host link, as expected.
    • vip_xlat_table holds all eight rows the bindings need: ingress and egress, TCP and UDP, both families, mapping the attachment's address and port 8443 to each VIP and port 443.
    • public_uplink_table holds its one row all zeros, link_ifindex: 0.

    So usid_egress finds the VIP translation, cannot redirect the reply because the uplink is unset, and falls through to the final listener_link() drop in internal/plumbing/ebpf/prog/usid.c.

    Why the row is never written, from reading main:

    • refreshPublicUplink (internal/installer/public_uplink.go) only rewrites a row that already exists. A row never written is left to CNI ADD or the datapath repair.
    • The datapath repair (internal/gc/datapath_repair.go) returns before FillNode when discoverAttachments finds no attachments, and FillNode is what calls ResolvePublicUplink and writes the row.
    • node-a runs no tenant pods, so CNI ADD never runs there, and its only attachment is the listener's, which galactic-edge creates rather than CNI ADD.

    The read of the code is an inference. The all-zero row and the drop are observed. Tenant NLB VIPs on the same gateways keep working because their backends sit on a compute node whose CNI ADD writes the row.

  3. added theissue type on Nov 30, 2026
  4. self-assigned this
    on Nov 30, 2026
  5. privateip commented on Nov 30, 2026

    @privateip
    ContributorAuthor

    Valid, confirmed against main at f8eee0c by reading the source, on top of the map dump in the comment above.

    Two registration paths write an attachment's datapath rows, and only one of them records the node's public uplink:

    • CNI ADD goes through attachreg.RegisterDatapath, which calls registerPublicUplink on every ADD as a per-node, non-fatal step (
      // Register this node's fabric-uplink next hop. Same per-node,
      // redo-on-every-ADD, non-fatal shape as registerNodeSourceAddress above,
      // for the same reason: resolving it needs a converged underlay neighbor.
      // usid_egress falls through to egress_route_table while the entry is
      // absent.
      if err := registerPublicUplink(pinDir); err != nil {
      slog.Warn("ADD: could not register this node's own public uplink; "+
      "a DSR backend's VIP-sourced reply traffic will fail open to egress_route_table until this succeeds",
      "err", err)
      }
      ).
    • galactic-edge's agent attaches a listener's host link through attachreg.RegisterHostLink (
      return attachreg.RegisterHostLink(d.PinDir, vrfTable, ifindex, ifname, addr)
      ). That writes the link's policy, ifindex_vrf_table and egress-kind rows and attaches usid_egress and tp_deliver, but never touches public_uplink_table (
      func RegisterHostLink(pinDir string, vrfTableID uint32, ifindex uint32, ifname string, addr netip.Addr) error {
      registry, closer, err := usidmap.OpenPinnedRegistry(pinDir)
      if err != nil {
      return fmt.Errorf("open pinned eBPF uSID maps: %w", err)
      }
      defer func() { _ = closer.Close() }()
      entries, err := registry.VRF.List()
      if err != nil {
      return fmt.Errorf("list eBPF vrf_table: %w", err)
      }
      var found bool
      var key usidmap.VRFKey
      argument := uint16(math.MaxUint16)
      for _, e := range entries {
      if e.VRFTableID == vrfTableID && e.Argument < argument {
      key, argument, found = e.VRFKey, e.Argument, true
      }
      }
      if !found {
      return fmt.Errorf("%w: table %d", ErrVRFNotRegistered, vrfTableID)
      }
      active, err := putHostLinkPolicy(pinDir, ifindex, addr)
      if err != nil {
      return err
      }
      table, tableCloser, err := ifindexvrfmap.OpenPinned(pinDir)
      if err != nil {
      return fmt.Errorf("open pinned eBPF ifindex_vrf_table: %w", err)
      }
      defer func() { _ = tableCloser.Close() }()
      if err := table.Register(ifindex, key.Block, key.Argument); err != nil {
      return fmt.Errorf("register eBPF ifindex_vrf_table entry: %w", err)
      }
      if err := registerEgressKind(pinDir, ifindex, usidmap.EgressKindVeth); err != nil {
      return err
      }
      if err := attachUsidEgress(pinDir, ifname); err != nil {
      return fmt.Errorf("attach eBPF usid_egress to host interface %q: %w", ifname, err)
      }
      // tp_deliver checks what the kernel itself transmits to the link: the
      // traffic policy, and an edge link's forwarding gate.
      program, err := ebpf.LoadPinnedProgram(filepath.Join(pinDir, attach.TpDeliverPinName), nil)
      if err != nil {
      return fmt.Errorf("load pinned tp_deliver: %w", err)
      }
      defer func() { _ = program.Close() }()
      if err := attach.AttachDeliver(program, ifname); err != nil {
      return fmt.Errorf("attach eBPF tp_deliver to host interface %q: %w", ifname, err)
      }
      if active {
      return verifyEnforcement(ifname)
      }
      return nil
      }
      ).

    Neither later pass fills the gap on a node with no CNI attachment:

    So an edge node whose only attachments are galactic-edge host links keeps an all-zero row, and usid_egress drops every listener reply after translating it. No regression test exists yet. The fix plan follows once it is agreed.

  6. privateip commented on Nov 30, 2026

    @privateip
    ContributorAuthor

    Fix plan, agreed.

    RegisterHostLink records the node's public uplink the same way CNI ADD does. After it attaches usid_egress, it calls registerPublicUplink, non-fatal with a warning, so a link still registers while the uplink neighbor is unresolved. registerPublicUplink resolves through a package variable that defaults to srv6.ResolvePublicUplink, so a test can inject it. Nothing else changes: once the row exists, the uplink watch keeps it current.

    Two alternatives were set aside. Writing a never-written row from the uplink watch would change its rule that a node with no backend records nothing. Running the datapath repair on nodes with no CNI attachment would need it to discover edge host links, and galactic-edge already registers them again after a map reload, so fixing the registration covers that case too.

    Test: a root test in attachreg registers a host link with a resolver that returns an uplink and checks the row is written, then with one that fails and checks registration still succeeds with the row unset. It fails on main today.

    Risk: every galactic-edge host link registration now writes the uplink row. Where CNI ADD has already written it, the write is the same value. No API, config or migration change.

  7. added 2 commits that reference this issue on Nov 30, 2026
    043642a
    2da44cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggalactic-cnigalactic-edge

Type

Fields

Priority

Low

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions