feat(endpoint): add DirectAddrFilter to drop direct address candidates#4397
Open
ifdario wants to merge 1 commit into
Open
feat(endpoint): add DirectAddrFilter to drop direct address candidates#4397ifdario wants to merge 1 commit into
ifdario wants to merge 1 commit into
Conversation
Add `Builder::direct_addr_filter`, taking a `DirectAddrFilter` trait object (`Arc<dyn>`, mirroring `PathSelector`), consulted in the magicsock's `update_direct_addresses` before the direct addresses are stored. A rejected address is never stored, published via Address Lookup, or offered as a holepunch / NAT-traversal candidate. This lets an application exclude the address of a virtual interface (e.g. a VPN overlay bound on a TUN device) from the candidate set while still binding to the unspecified address for normal multi-homing. `addr_filter` only filters published data; this filters the underlying candidate set, so it also covers in-band NAT-traversal.
5 tasks
Contributor
|
For the random observer: this is linked to #4399 and we need to decide which approach is best. |
Author
|
I think they fill different needs |
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.
Description
Adds
Builder::direct_addr_filterto drop addresses from the endpoint's directaddress candidates. A dropped address is not stored, published, or used for
holepunching / NAT-traversal.
This lets an app exclude a virtual interface's address (e.g. a VPN overlay on a
TUN device) that would otherwise be advertised and dialed by peers, looping the
underlay back into the tunnel.
addr_filteronly covers published data; this runson the candidate set before
store_direct_addresses, so it also covers in-bandNAT-traversal.
DirectAddrFiltertrait (keeps(&self, ip) -> bool), modelled onPathSelector.Builder::direct_addr_filter, stored onOptions/Socket, applied inupdate_direct_addresses.Breaking Changes
None. Optional, defaults to off.
Notes & open questions
Applied at the final gate so it covers all sources (local, QAD, portmap, config).
Could be scoped to local-interface addresses instead if preferred.
Change checklist
proposed change and wrote an as clear and concise description as
they could.
intented effect.