fix: honor address family for SOCKS4 forwarding - #263
Merged
Conversation
Thread the resolved AddressFamily into the SOCKS4 dynamic forwarding path so forced IPv6 now fails closed with a protocol-correct 0x5B rejection instead of silently tunneling IPv4. Update the -D help text and manpage to state the real SOCKS4 guarantee under -4/-6, and add focused regression tests around the forced-family destination selection helper. Validation: - cargo check --lib - cargo test --test address_family_test - cargo check --lib --tests (fails in pre-existing src/ssh/tokio_client/to_socket_addrs_with_hostname.rs test-module errors) - cargo clippy --lib --tests -- -D warnings (fails on the same pre-existing test-module errors) Refs #255
Refactor the SOCKS4 handler through a minimal stream-generic seam so acceptance-level tests can drive the real request parser and response path without changing production behavior. The new tests send full SOCKS4 frames, prove forced IPv6 returns a 0x5B rejection before the channel-open seam, and prove AddressFamily::Any and V4 reach the seam after parsing the request. Validation: - cargo test --lib forwarding::dynamic::socks::tests - cargo test --test address_family_test - cargo fmt --all - cargo check --lib --tests - cargo clippy --lib --tests -- -D warnings Refs #255
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
Honor the resolved address-family policy in the real SOCKS4 dynamic-forwarding path instead of silently using AddressFamily::Any.
What changed
Test plan
Closes #255