mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-21 07:46:04 +08:00
fix range check
This commit is contained in:
parent
dbec514d5d
commit
b2e5b239db
|
@ -271,7 +271,7 @@ func GetAllowedIPs(node, peer *models.Node) []net.IPNet {
|
|||
egressIPs := getEgressIPs(node, peer)
|
||||
// remove internet gateway if server
|
||||
if node.IsServer == "yes" {
|
||||
for i := len(egressIPs) - 1; i <= 0; i-- {
|
||||
for i := len(egressIPs) - 1; i >= 0; i-- {
|
||||
if egressIPs[i].IP.String() == "0.0.0.0/0" || egressIPs[i].IP.String() == "::/0" {
|
||||
egressIPs = append(egressIPs[:i], egressIPs[i+1:]...)
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ func ManageZombies(ctx context.Context) {
|
|||
case id := <-removeZombie:
|
||||
found := false
|
||||
if len(zombies) > 0 {
|
||||
for i := len(zombies) - 1; i <= 0; i-- {
|
||||
for i := len(zombies) - 1; i >= 0; i-- {
|
||||
if zombies[i] == id {
|
||||
logger.Log(1, "removing zombie from quaratine list", zombies[i])
|
||||
zombies = append(zombies[:i], zombies[i+1:]...)
|
||||
|
@ -61,7 +61,7 @@ func ManageZombies(ctx context.Context) {
|
|||
}
|
||||
case <-time.After(time.Second * ZOMBIE_TIMEOUT):
|
||||
if len(zombies) > 0 {
|
||||
for i := len(zombies) - 1; i <= 0; i-- {
|
||||
for i := len(zombies) - 1; i >= 0; i-- {
|
||||
node, err := GetNodeByID(zombies[i])
|
||||
if err != nil {
|
||||
logger.Log(1, "error retrieving zombie node", zombies[i], err.Error())
|
||||
|
|
Loading…
Reference in a new issue