Skip to content

Error Parsing IPv6 During Swarm Cluster Join #1601

@jtopjian

Description

@jtopjian

When creating a Swarm cluster with IPv6 addresses, a worker will fail to fully join the cluster due to the brackets being stripped. The resulting error is:

time="2016-12-23T07:27:26.368614166Z" level=warning msg="2016/12/23 07:27:26 
[WARN] memberlist: Failed to resolve 2001:fd00:4:1000:f816:3eff:fe78:3323: 
too many colons in address 2001:fd00:4:1000:f816:3eff:fe78:3323\n"

This is happening during the net.SplitHostPort call here.

A quick patch of:

remoteIP := net.ParseIP(remoteAddr)
if remoteIP.To4() == nil {
        remoteAddr = fmt.Sprintf("[%s]", remoteIP)
}

resolves the issue and the worker is then able to successfully join the cluster, though I'm not sure if that's the best way to resolve the issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions