ssh: Fix IPv6 address formatting in port forward -L arguments#49032
Merged
Veykril merged 2 commits intozed-industries:mainfrom Feb 26, 2026
Merged
ssh: Fix IPv6 address formatting in port forward -L arguments#49032Veykril merged 2 commits intozed-industries:mainfrom
-L arguments#49032Veykril merged 2 commits intozed-industries:mainfrom
Conversation
IPv6 addresses in SSH `-L` port-forward arguments must be wrapped in brackets (e.g. `[::1]:8080:[::1]:80`) to disambiguate from the colon delimiters. Without brackets, SSH cannot parse the argument correctly, causing port forwarding to silently fail. This also fixes `parse_port_forward_spec` to handle bracket-wrapped IPv6 tokens, and adds diagnostic logging for stdin read failures in the remote server. Co-Authored-By: Claude <[email protected]>
Contributor
Co-Authored-By: Claude Opus 4.6 <[email protected]>
auto-merge was automatically disabled
February 26, 2026 01:57
Head branch was pushed to by a user without write access
rtfeldman
pushed a commit
that referenced
this pull request
Feb 27, 2026
## Summary - Fix SSH `-L` port-forward arguments to wrap IPv6 addresses in brackets (e.g. `-L[::1]:8080:[::1]:80`), so SSH can correctly parse them - Rewrite `parse_port_forward_spec` to support bracket-wrapped IPv6 tokens like `[::1]:8080:[::1]:80` - Add diagnostic logging for stdin read failures in the remote server to aid debugging connection issues Closes #49009 ## Test plan - [x] New unit tests: `test_parse_port_forward_spec_ipv6`, `test_port_forward_ipv6_formatting`, `test_build_command_with_ipv6_port_forward` - [x] Existing tests pass: `cargo test -p remote --lib transport::ssh::tests` (6/6) - [ ] Manual verification: connect via SSH to an IPv6 host with port forwarding configured 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
tahayvr
pushed a commit
to tahayvr/zed
that referenced
this pull request
Mar 4, 2026
…industries#49032) ## Summary - Fix SSH `-L` port-forward arguments to wrap IPv6 addresses in brackets (e.g. `-L[::1]:8080:[::1]:80`), so SSH can correctly parse them - Rewrite `parse_port_forward_spec` to support bracket-wrapped IPv6 tokens like `[::1]:8080:[::1]:80` - Add diagnostic logging for stdin read failures in the remote server to aid debugging connection issues Closes zed-industries#49009 ## Test plan - [x] New unit tests: `test_parse_port_forward_spec_ipv6`, `test_port_forward_ipv6_formatting`, `test_build_command_with_ipv6_port_forward` - [x] Existing tests pass: `cargo test -p remote --lib transport::ssh::tests` (6/6) - [ ] Manual verification: connect via SSH to an IPv6 host with port forwarding configured 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
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
-Lport-forward arguments to wrap IPv6 addresses in brackets (e.g.-L[::1]:8080:[::1]:80), so SSH can correctly parse themparse_port_forward_specto support bracket-wrapped IPv6 tokens like[::1]:8080:[::1]:80Closes #49009
Test plan
test_parse_port_forward_spec_ipv6,test_port_forward_ipv6_formatting,test_build_command_with_ipv6_port_forwardcargo test -p remote --lib transport::ssh::tests(6/6)🤖 Generated with Claude Code