Skip to content

bug: support IPv6 bind addresses for SSH forwarding #2279

Description

@ShiroKSH

Agent Diagnostic

  • Loaded the repository's openshell-cli guide and traced openshell forward start through ForwardSpec and the SSH command builder.
  • Investigated source at 97e1051 (main).
  • Latest release checked: v0.0.83 (published 2026-07-14). I could not run its binary locally because the required Rust 1.90 toolchain is not functioning in this environment.
  • Known fixes and possible duplicates: searched all issues and pull requests for IPv6 SSH forwarding; no matching report or change found.
  • Finding: ForwardSpec::parse("::1:8080") accepts an IPv6 bind address, while ssh_forward_arg() emits ::1:8080:127.0.0.1:8080. OpenSSH rejects that unbracketed local-forward specification. The same path also displays an invalid IPv6 URL and treats the bind-only gateway address :: as connectable.
  • Fix ready locally: bracket IPv6 literals for ssh -L, reuse the existing URL formatter for displayed addresses, substitute :: with the reachable cluster host, and add focused regression tests.

Description

Actual behavior: openshell forward start ::1:8080 <sandbox> builds an invalid SSH local-forward argument. A gateway that advertises the IPv6 wildcard address :: can also lead the CLI to attempt a connection to an unspecified address.

Expected behavior: IPv6 loopback and wildcard bind configurations should produce valid OpenSSH arguments and use a reachable gateway host.

Reproduction Steps

  1. Configure a sandbox forward with an IPv6 bind address, for example openshell forward start ::1:8080 <sandbox>.
  2. The CLI constructs -L ::1:8080:127.0.0.1:8080.
  3. OpenSSH rejects the argument before connecting. The equivalent bracketed argument is accepted:
ssh -G -L '::1:23456:127.0.0.1:23456' example.invalid
ssh -G -L '[::1]:23456:127.0.0.1:23456' example.invalid

Environment

  • OS: Windows 11
  • OpenSSH: OpenSSH_for_Windows_9.5p2
  • OpenShell source: 97e1051 on main
  • Latest release checked: v0.0.83; not executed locally because Rust 1.90 is unavailable in this environment
  • Possible duplicates checked: yes; no matching issue or pull request found

Logs

Bad local forwarding specification '::1:23456:127.0.0.1:23456'

Contribution

I have the complete, focused patch and regression tests ready on a local branch and can open a PR immediately. If this is suitable as a first contribution, I would appreciate a vouch so I can submit it for review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions