mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-04 10:54:24 +08:00
remove internet gateway from server peers allowed ip
This commit is contained in:
parent
ec40ea78d3
commit
044e0734c1
1 changed files with 8 additions and 0 deletions
|
@ -269,6 +269,14 @@ func GetAllowedIPs(node, peer *models.Node) []net.IPNet {
|
||||||
if peer.IsEgressGateway == "yes" {
|
if peer.IsEgressGateway == "yes" {
|
||||||
//hasGateway = true
|
//hasGateway = true
|
||||||
egressIPs := getEgressIPs(node, peer)
|
egressIPs := getEgressIPs(node, peer)
|
||||||
|
// remove internet gateway if server
|
||||||
|
if node.IsServer == "yes" {
|
||||||
|
for i, ip := range egressIPs {
|
||||||
|
if ip.IP.String() == "0.0.0.0/0" || ip.IP.String() == "::/0" {
|
||||||
|
egressIPs = append(egressIPs[:i], egressIPs[i+1:]...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
allowedips = append(allowedips, egressIPs...)
|
allowedips = append(allowedips, egressIPs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue