Skip to content

hot_restart: fix socket handoff for listeners with network namespace addresses#43653

Merged
ravenblackx merged 4 commits into
envoyproxy:mainfrom
jronak:hot-restart-network-namespace
Mar 2, 2026
Merged

hot_restart: fix socket handoff for listeners with network namespace addresses#43653
ravenblackx merged 4 commits into
envoyproxy:mainfrom
jronak:hot-restart-network-namespace

Conversation

@jronak
Copy link
Copy Markdown
Contributor

@jronak jronak commented Feb 26, 2026

Commit Message: Hot restart socket handoff fails when a listener has network_namespace_filepath configured. The PassListenSocket request only carries the address string (e.g. tcp://0.0.0.0:80), the network namespace is lost. On the parent side, resolveUrl produces an address with networkNamespace() == nullopt, which never matches the listener's namespaced address (since operator== checks namespace equality). The result is fd == -1, the child falls back to binding a new socket, breaking handoff.

This PR fixes it by passing the network namespace hot restart socket handoff path in child and parent handling.

Risk Level: Low, only affects listeners with network_namespace_filepath set, which were already broken during hot restart.

Testing: Updated and added unit tests in hot_restarting_parent_test.cc covering namespace match, mismatch, and mixed (namespace vs no-namespace) cases.
Docs Changes: Updated Changelog
Release Notes: NA
Platform Specific Features: NA

@jronak jronak force-pushed the hot-restart-network-namespace branch from 3fff32c to 27b1392 Compare February 26, 2026 07:01
Hot restart socket handoff fails when a listener has
network_namespace_filepath configured. The PassListenSocket request only
carries the address string, so the parent resolves an address without a
namespace that never matches the listener's namespaced address.

Thread the network namespace through the PassListenSocket proto, child
request, and parent resolution so that namespaced addresses match
correctly during hot restart.

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>
@jronak jronak force-pushed the hot-restart-network-namespace branch from 27b1392 to b1597be Compare February 26, 2026 07:30
…-namespace

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>
@jronak jronak force-pushed the hot-restart-network-namespace branch from 5c5b442 to 82a31ce Compare February 26, 2026 14:49
@RyanTheOptimist
Copy link
Copy Markdown
Contributor

/assign @ravenblackx

Copy link
Copy Markdown
Contributor

@ravenblackx ravenblackx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of changes but they're all nitpicky, the general thrust of the PR looks great, thanks!

Comment thread envoy/server/hot_restart.h Outdated
Comment thread source/common/listener_manager/listener_manager_impl.cc Outdated
Comment thread source/common/listener_manager/listener_manager_impl.cc Outdated
Comment thread source/server/hot_restart_impl.cc Outdated
Comment thread source/server/hot_restart_impl.h Outdated
Comment thread source/server/hot_restarting_parent.cc Outdated
Comment thread test/mocks/server/hot_restart.cc Outdated
Comment thread test/mocks/server/hot_restart.h Outdated
Comment thread test/server/hot_restarting_parent_test.cc Outdated
Comment thread test/server/hot_restarting_parent_test.cc Outdated
…setup

- Use absl::string_view instead of const std::string& for network_namespace
  parameter across hot restart interfaces
- Use std::make_shared instead of raw new for address construction in tests
- Simplify ON_CALL mock setup to not specify arg matchers
- Use "" instead of std::string() for empty namespace default

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>
auto-merge was automatically disabled February 28, 2026 07:46

Head branch was pushed to by a user without write access

Avoids unnecessary local variable by passing the network namespace
directly to the function call.

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>
@jronak
Copy link
Copy Markdown
Contributor Author

jronak commented Feb 28, 2026

/retest

@ravenblackx
Copy link
Copy Markdown
Contributor

Normally this would need approval from a senior maintainer too since it touches core code - I'm going to assume @RyanTheOptimist previously enabling auto-merge counts as that endorsement.

@ravenblackx ravenblackx merged commit 152aa1f into envoyproxy:main Mar 2, 2026
28 of 29 checks passed
bmjask pushed a commit to bmjask/envoy that referenced this pull request Mar 14, 2026
…addresses (envoyproxy#43653)

Commit Message: Hot restart socket handoff fails when a listener has
`network_namespace_filepath` configured. The `PassListenSocket` request
only carries the address string (e.g. `tcp://0.0.0.0:80`), the network
namespace is lost. On the parent side, `resolveUrl` produces an address
with `networkNamespace() == nullopt`, which never matches the listener's
namespaced address (since `operator==` checks namespace equality). The
result is `fd == -1`, the child falls back to binding a new socket,
breaking handoff.

This PR fixes it by passing the network namespace hot restart socket
handoff path in child and parent handling.

Risk Level: Low, only affects listeners with
`network_namespace_filepath` set, which were already broken during hot
restart.

Testing: Updated and added unit tests in `hot_restarting_parent_test.cc`
covering namespace match, mismatch, and mixed (namespace vs
no-namespace) cases.
Docs Changes: Updated Changelog
Release Notes: NA
Platform Specific Features: NA

---------

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>
Signed-off-by: bjmask <11672696+bjmask@users.noreply.github.com>
bvandewalle pushed a commit to bvandewalle/envoy that referenced this pull request Mar 17, 2026
…addresses (envoyproxy#43653)

Commit Message: Hot restart socket handoff fails when a listener has
`network_namespace_filepath` configured. The `PassListenSocket` request
only carries the address string (e.g. `tcp://0.0.0.0:80`), the network
namespace is lost. On the parent side, `resolveUrl` produces an address
with `networkNamespace() == nullopt`, which never matches the listener's
namespaced address (since `operator==` checks namespace equality). The
result is `fd == -1`, the child falls back to binding a new socket,
breaking handoff.

This PR fixes it by passing the network namespace hot restart socket
handoff path in child and parent handling.

Risk Level: Low, only affects listeners with
`network_namespace_filepath` set, which were already broken during hot
restart.

Testing: Updated and added unit tests in `hot_restarting_parent_test.cc`
covering namespace match, mismatch, and mixed (namespace vs
no-namespace) cases.
Docs Changes: Updated Changelog
Release Notes: NA
Platform Specific Features: NA

---------

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>
fishcakez pushed a commit to fishcakez/envoy that referenced this pull request Mar 25, 2026
…addresses (envoyproxy#43653)

Commit Message: Hot restart socket handoff fails when a listener has
`network_namespace_filepath` configured. The `PassListenSocket` request
only carries the address string (e.g. `tcp://0.0.0.0:80`), the network
namespace is lost. On the parent side, `resolveUrl` produces an address
with `networkNamespace() == nullopt`, which never matches the listener's
namespaced address (since `operator==` checks namespace equality). The
result is `fd == -1`, the child falls back to binding a new socket,
breaking handoff.

This PR fixes it by passing the network namespace hot restart socket
handoff path in child and parent handling.

Risk Level: Low, only affects listeners with
`network_namespace_filepath` set, which were already broken during hot
restart.

Testing: Updated and added unit tests in `hot_restarting_parent_test.cc`
covering namespace match, mismatch, and mixed (namespace vs
no-namespace) cases.
Docs Changes: Updated Changelog
Release Notes: NA
Platform Specific Features: NA

---------

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>
krinkinmu pushed a commit to grnmeira/envoy that referenced this pull request Apr 20, 2026
…addresses (envoyproxy#43653)

Commit Message: Hot restart socket handoff fails when a listener has
`network_namespace_filepath` configured. The `PassListenSocket` request
only carries the address string (e.g. `tcp://0.0.0.0:80`), the network
namespace is lost. On the parent side, `resolveUrl` produces an address
with `networkNamespace() == nullopt`, which never matches the listener's
namespaced address (since `operator==` checks namespace equality). The
result is `fd == -1`, the child falls back to binding a new socket,
breaking handoff.

This PR fixes it by passing the network namespace hot restart socket
handoff path in child and parent handling.

Risk Level: Low, only affects listeners with
`network_namespace_filepath` set, which were already broken during hot
restart.

Testing: Updated and added unit tests in `hot_restarting_parent_test.cc`
covering namespace match, mismatch, and mixed (namespace vs
no-namespace) cases.
Docs Changes: Updated Changelog
Release Notes: NA
Platform Specific Features: NA

---------

Signed-off-by: Ronak Jain <ronakjainc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants