Skip to content

IPv6 connection addresses are invalid, cannot connect via ssh #245

@jooola

Description

@jooola

Overview of the Issue

Packer cannot connect to hosts using an ipv6 addresses, The format for the connection address is invalid.

The current construction of the connection address is a simple: fmt.Sprintf("%s:%d", host, port) but this does not work for ipv6, as the host needs to be wrapped between brackets when using ipv6.

  • 2a01:4f9:c012:e095::1:22: invalid
  • [2a01:4f9:c012:e095::1]:22: valid

I'll open a Pull Request.

Reproduction Steps

Try to run a build against an ipv6 only host.

Packer Plugin SDK version

Current main branch: 1a2b341

Operating system and Environment details

Linux, probably also windows.

Log Fragments and crash.log files

==> hcloud.example: Waiting for SSH to become available...
2024/06/06 10:00:10 packer-plugin-hcloud_v1.5.1_x5.0_linux_amd64 plugin: 2024/06/06 10:00:10 [DEBUG] TCP connection to SSH ip/port failed: dial tcp: address 2a01:4f9:c012:e095::1:22: too many colons in address
2024/06/06 10:00:15 packer-plugin-hcloud_v1.5.1_x5.0_linux_amd64 plugin: 2024/06/06 10:00:15 [DEBUG] TCP connection to SSH ip/port failed: dial tcp: address 2a01:4f9:c012:e095::1:22: too many colons in address
2024/06/06 10:00:20 packer-plugin-hcloud_v1.5.1_x5.0_linux_amd64 plugin: 2024/06/06 10:00:20 [DEBUG] TCP connection to SSH ip/port failed: dial tcp: address 2a01:4f9:c012:e095::1:22: too many colons in address
2024/06/06 10:00:25 packer-plugin-hcloud_v1.5.1_x5.0_linux_amd64 plugin: 2024/06/06 10:00:25 [DEBUG] TCP connection to SSH ip/port failed: dial tcp: address 2a01:4f9:c012:e095::1:22: too many colons in address

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions