pkg/mesh: fix ip allocator helper
This commit fixes the ip allocator `newAllocator` to produce IP addresses with the original network mask. This is makes more sense. The original functionality can be reproduced by wrapping the produced IP address with the `oneAddressCIDR` helper. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
@@ -154,7 +154,7 @@ func NewTopology(nodes map[string]*Node, peers map[string]*Peer, granularity Gra
|
||||
return nil, errors.New("failed to allocate an IP address; ran out of IP addresses")
|
||||
}
|
||||
segment.wireGuardIP = ipNet.IP
|
||||
segment.allowedIPs = append(segment.allowedIPs, ipNet)
|
||||
segment.allowedIPs = append(segment.allowedIPs, oneAddressCIDR(ipNet.IP))
|
||||
if t.leader && segment.location == t.location {
|
||||
t.wireGuardCIDR = &net.IPNet{IP: ipNet.IP, Mask: t.subnet.Mask}
|
||||
}
|
||||
|
Reference in New Issue
Block a user