Skip to content

hot restart: UDP packet forwarding ignores the listener network namespace #47742

Closed

Description

@bpalermo

Title: hot restart: UDP packet forwarding ignores the listener network namespace

Description:
Since #46502 the draining parent keeps its raw UDP listeners and forwards datagrams of unknown sessions to the child over the hot restart RPC. Two parts of that path are namespace-blind:

  • The child's forwarding registry keys listeners by address->asString() (HotRestartingChild::UdpForwardingContext::registerListener, source/server/hot_restarting_child.cc), which for IP addresses is just ip:port and omits the network namespace of a listener bound with network_namespace_filepath. With several listeners on the same ip:port in different namespaces, only the first registration survives (try_emplace; the duplicate assert is debug-only).
  • The parent forwards urlFromDatagramAddress(packet.addresses_.local_) (HotRestartingParent::Internal::handle, source/server/hot_restarting_parent.cc), i.e. the datagram's destination, also without a namespace. On a transparent socket that is the original destination address rather than the bind address, so the child's lookup falls through to the 0.0.0.0:<port> default entry.

Result: every forwarded datagram from any of those listeners is delivered to the first-registered listener's udp_proxy, so replies leave from a socket in the wrong namespace and sessions are counted under the wrong listener's stats. Socket inheritance itself is namespace-aware (getListenSocketsForChild matches with withNetworkNamespace, and address equality compares the namespace), so only the forwarding path is affected.

Repro steps:

  1. Configure N UDP listeners bound to 0.0.0.0:<port> with distinct network_namespace_filepath values and a udp_proxy filter each.
  2. Hot restart while new UDP flows arrive on listeners other than the first one configured.
  3. During the drain overlap the flows are handled by the first listener's udp_proxy (visible under its stat prefix), and replies are sent from that listener's socket.

Proposed fix:
Forward the listener's bind address and network namespace in ForwardedUdpPacket (in addition to the datagram destination, for compatibility with older parents), key the child's registry on address plus namespace, and resolve forwarded packets by listener address first, falling back to the destination-based lookup only for messages without the new fields.

I have a change for this in progress.

Activity

  1. added a commit that references this issue on Sep 30, 2026
    a644fc6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions