fix: preserve forwarded target hostnames by default - #258
Merged
Conversation
Send direct-tcpip forwarding targets as hostnames when no address family is forced, matching OpenSSH server-side resolution for local forwards, SOCKS5 domain requests, and tunneled jump-chain hops. Forced -4/-6 and AddressFamily inet/inet6 paths still resolve locally, filter to the requested family, and send numeric addresses so the forced-family guarantee remains explicit. Validated with focused direct-tcpip target tests, host-port parser tests, cargo check --lib --tests, cargo clippy --lib --tests -- -D warnings, and cargo fmt --check.
Make the new host_port trait hook default to parsing hostname(), so downstream ToSocketAddrsWithHostname implementers are not forced to add a new method just to keep compiling. Validated with the focused direct-tcpip target tests, host-port parser tests, cargo check --lib --tests, cargo clippy --lib --tests -- -D warnings, and cargo fmt --check.
inureyes
added a commit
that referenced
this pull request
Aug 3, 2026
## Summary - Restore `&[SocketAddr]::host_port` to the trait implementation after the PR #260 / PR #258 auto-merge placed it inside the test module. - Merge the #243 first-address hostname tests and #257 host-port parsing tests into one valid `tests` module so both behavior checks remain compiled. ## Validation - `cargo fmt --check` - `CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo test --lib to_socket_addrs_with_hostname` - `CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo check --lib --tests` - `CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo clippy --lib --tests -- -D warnings` Refs #243. Refs #257.
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.
Summary
Preserve server-side resolution for direct-tcpip forwarding targets when no address family is forced, while keeping local resolve-and-filter behavior for explicit -4/-6 or AddressFamily inet/inet6 requests.
What changed
Added DNS-free host/port extraction to the direct-tcpip target abstraction so hostnames can be sent as written in the unforced forwarding path.
Routed local forwards, SOCKS5 domain requests, and tunneled jump-chain targets through hostname-preserving direct-tcpip requests under AddressFamily::Any, with forced-family paths still sending filtered numeric addresses.
Updated the channel-manager doc comment, SOCKS5 comment, manpage, and architecture scope table to describe the implemented resolution model.
Test plan
CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo test --lib direct_tcpip_request_targets
CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo test --lib host_port_parses
CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo check --lib --tests
CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo clippy --lib --tests -- -D warnings
cargo fmt --check
Closes #257