mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-24 01:13:11 +08:00
remove internet gateway from server peers allowed ip
This commit is contained in:
@@ -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...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user