From 7ec834617959025bb3294d6dadb2ee3b070e62e0 Mon Sep 17 00:00:00 2001 From: Csaba Sarkadi Date: Sun, 31 Oct 2021 16:05:48 +0100 Subject: [PATCH] Do not assume IPv4 during Tailscale node construction --- machine.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/machine.go b/machine.go index d58c9c5c..c13d79d7 100644 --- a/machine.go +++ b/machine.go @@ -470,16 +470,16 @@ func (machine Machine) toNode( } addrs := []netaddr.IPPrefix{} - ip, err := netaddr.ParseIPPrefix(fmt.Sprintf("%s/32", machine.IPAddress)) + nodeAddr, err := netaddr.ParseIP(m.IPAddresses) if err != nil { log.Trace(). Caller(). - Str("ip", machine.IPAddress). - Msgf("Failed to parse IP Prefix from IP: %s", machine.IPAddress) - + Str("ip", machine.IPAddresses). + Msgf("Failed to parse machine IP: %s", machine.IPAddresses) return nil, err } - addrs = append(addrs, ip) // missing the ipv6 ? + ip := netaddr.IPPrefixFrom(nodeAddr, nodeAddr.BitLen()) + addrs = append(addrs, ip) allowedIPs := []netaddr.IPPrefix{} allowedIPs = append(