listener: reject bind_to_port: false on UDP listeners#46386
Open
mateenali66 wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
fix/46231-no-bind-udp-validate
branch
from
July 26, 2026 07:55
b8cd1d2 to
2424c56
Compare
Contributor
|
This looks good to me, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: falseno 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 increateListenSocketInternal()only runs whenbind_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