Skip to content

listener: reject bind_to_port: false on UDP listeners#46386

Open
mateenali66 wants to merge 1 commit into
envoyproxy:mainfrom
mateenali66:fix/46231-no-bind-udp-validate
Open

listener: reject bind_to_port: false on UDP listeners#46386
mateenali66 wants to merge 1 commit into
envoyproxy:mainfrom
mateenali66:fix/46231-no-bind-udp-validate

Conversation

@mateenali66

@mateenali66 mateenali66 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Commit Message: listener: reject bind_to_port: false on UDP listeners

Additional Description:
Follows the direction from the review of #46264: reject the combination in ListenerImpl::validateConfig() next to the existing mptcp checks, instead of guarding the socket creation path.

Why rejection is safe: UDP listeners unconditionally add socket options (packet info etc.), and with bind_to_port: false no socket is created to apply them to, so startup always dereferenced a null socket handle. There is also no fd-injection path for no-bind UDP: the hot-restart parent socket duplication in createListenSocketInternal() only runs when bind_type != NoBind, so this configuration could never have been used for passing pre-bound sockets.

Opened as a public PR per the issue: "Crash on startup with specific config. Ok to fix in the open."

Risk Level: Low. Configurations that previously crashed at startup now fail config validation; no functional configuration is affected.

Testing: two new listener manager unit tests (plain UDP and QUIC listener with bind_to_port: false), mirroring the adjacent MptcpOnUdp validation test.

Docs Changes: n/a

Release Notes: changelogs/current/bug_fixes/listener__reject-no-bind-udp.rst

Platform Specific Features: n/a

Fixes #46231

UDP listeners unconditionally add socket options, but with bind_to_port
disabled no socket is created to apply them to, so startup dereferenced
a null socket handle and crashed. Reject the combination at config load
in ListenerImpl::validateConfig(), following the existing mptcp
validation precedent.

Fixes envoyproxy#46231

Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
@mateenali66
mateenali66 force-pushed the fix/46231-no-bind-udp-validate branch from b8cd1d2 to 2424c56 Compare July 26, 2026 07:55
@filipcacky

Copy link
Copy Markdown
Contributor

This looks good to me, thanks!

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.

bind_to_port: false on a UDP/QUIC listener crashes Envoy

2 participants