Repository navigation
feat(client): set IP_BIND_ADDRESS_NO_PORT before binding a local address - #355
Open
basundhara-c wants to merge 1 commit into
Open
basundhara-c wants to merge 1 commit into
basundhara-c wants to merge 1 commit into
Conversation
Signed-off-by: Basundhara Chakrabarty <basundhara17061996@gmail.com>
basundhara-c
force-pushed
the
bind-address-no-port
branch
from
November 25, 2026 07:26
27eab27 to
2a0e12a
Compare
basundhara-c
marked this pull request as ready for review
November 25, 2026 07:31
This branch has not been deployed
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.
When
HttpConnectorhas a local address set,bind_local_addressbindsip:0beforeconnect. Linux then picks the source port at bind time without knowing the destination, so every socket from that local IP takes a port from the same ephemeral range. A client that opens many connections from one bound address to many different destinations fails withEADDRNOTAVAILonce the range is used up, even though each destination only has a few connections.This sets
IP_BIND_ADDRESS_NO_PORTon Linux and Android before that bind. The kernel then picks the port atconnect, where it only needs to be unique per destination, so the same local port can be reused toward different destinations. If the option can't be set, it logs a warning and binds as before.Envoy does the same for upstream connections with a bound source address (envoyproxy/envoy#45916).
Added
local_address_sets_bind_address_no_port, which connects with and without a local address and reads the option back off the socket.