Skip to content

fix: preserve forwarded target hostnames by default - #258

Merged
inureyes merged 2 commits into
mainfrom
fix/issue-257-server-side-forward-resolution
Aug 3, 2026
Merged

fix: preserve forwarded target hostnames by default#258
inureyes merged 2 commits into
mainfrom
fix/issue-257-server-side-forward-resolution

Conversation

@inureyes

@inureyes inureyes commented Aug 3, 2026

Copy link
Copy Markdown
Member

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

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.
@inureyes inureyes added type:bug Something isn't working priority:medium Medium priority issue status:review Under review labels Aug 3, 2026
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 inureyes added status:done Completed and removed status:review Under review labels Aug 3, 2026
@inureyes
inureyes merged commit 8171527 into main Aug 3, 2026
3 checks passed
@inureyes
inureyes deleted the fix/issue-257-server-side-forward-resolution branch August 3, 2026 10:46
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium priority issue status:done Completed type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: direct-tcpip forwarding targets are resolved locally, breaking names only resolvable from the server

1 participant