Skip to content

Commit

Permalink
Fix ipv6 join failure
Browse files Browse the repository at this point in the history
  • Loading branch information
42wim committed Apr 6, 2017
1 parent f13fc99 commit d38ceaa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions consul/servers/serf_flooder.go
Expand Up @@ -69,6 +69,17 @@ func FloodJoins(logger *log.Logger, portFn FloodPortFn,
// leave it blank to behave as if we just supplied an address.
if port, ok := portFn(server); ok {
addr = net.JoinHostPort(addr, fmt.Sprintf("%d", port))
} else {
// globalSerf.Join expects bracketed ipv6 addresses
ip := net.ParseIP(addr)
if ip == nil {
// should never happen
logger.Printf("[DEBUG] consul: Failed to parse IP %s", addr)
}
// If we have an IPv6 address, we should add brackets
if ip.To4() == nil {
addr = fmt.Sprintf("[%s]", addr)
}
}

// Do the join!
Expand Down

0 comments on commit d38ceaa

Please sign in to comment.