Skip to content

ssh: Fix IPv6 address formatting in port forward -L arguments#49032

Merged
Veykril merged 2 commits intozed-industries:mainfrom
chenwuji2000-cyber:fix/ssh-ipv6-connection
Feb 26, 2026
Merged

ssh: Fix IPv6 address formatting in port forward -L arguments#49032
Veykril merged 2 commits intozed-industries:mainfrom
chenwuji2000-cyber:fix/ssh-ipv6-connection

Conversation

@chenwuji2000-cyber
Copy link
Copy Markdown
Contributor

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

  • New unit tests: test_parse_port_forward_spec_ipv6, test_port_forward_ipv6_formatting, test_build_command_with_ipv6_port_forward
  • 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

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]>
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 12, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Feb 12, 2026
Copy link
Copy Markdown
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Veykril Veykril enabled auto-merge (squash) February 25, 2026 09:13
@zed-industries-bot
Copy link
Copy Markdown
Contributor

zed-industries-bot commented Feb 25, 2026

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against ea25072

auto-merge was automatically disabled February 26, 2026 01:57

Head branch was pushed to by a user without write access

@Veykril Veykril enabled auto-merge (squash) February 26, 2026 08:32
@Veykril Veykril merged commit 7cca7bc into zed-industries:main Feb 26, 2026
27 checks passed
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote SSH IP6: Stays in connection dialog after starting proxy

4 participants