mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-22 08:24:25 +01:00
make sure hosts use the correct IP addresses when relaying
This commit is contained in:
@@ -1425,7 +1425,7 @@ func (d *NebulaMetaDetails) GetRelays() []netip.Addr {
|
||||
return relays
|
||||
}
|
||||
|
||||
// FindNetworkUnion returns the first netip.Addr contained in the list of provided netip.Prefix, if able
|
||||
// findNetworkUnion returns the first netip.Addr of addrs contained in the list of provided netip.Prefix, if able
|
||||
func findNetworkUnion(prefixes []netip.Prefix, addrs []netip.Addr) (netip.Addr, bool) {
|
||||
for i := range prefixes {
|
||||
for j := range addrs {
|
||||
@@ -1450,3 +1450,13 @@ func (d *NebulaMetaDetails) GetVpnAddrAndVersion() (netip.Addr, cert.Version, er
|
||||
return netip.Addr{}, cert.Version1, ErrBadDetailsVpnAddr
|
||||
}
|
||||
}
|
||||
|
||||
func (d *NebulaControl) GetRelayFrom() netip.Addr {
|
||||
if d.OldRelayFromAddr != 0 {
|
||||
b := [4]byte{}
|
||||
binary.BigEndian.PutUint32(b[:], d.OldRelayFromAddr)
|
||||
return netip.AddrFrom4(b)
|
||||
} else {
|
||||
return protoAddrToNetAddr(d.RelayFromAddr)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user