Skip to content

Commit

Permalink
fix dhcp with IP addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-nettica committed Jun 26, 2024
1 parent 2185037 commit e82fa32
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,26 @@ func GetAllReservedNetIps(netId string) ([]string, error) {
if err != nil {
return nil, err
}
reserverIps := make([]string, 0)
reservedIps := make([]string, 0)

for _, client := range clients {
if client.NetId == netId {
for _, cidr := range client.Current.Address {
ip, err := util.GetIpFromCidr(cidr)
if err != nil {
reservedIps = append(reservedIps, cidr)
log.WithFields(log.Fields{
"err": err,
"cidr": cidr,
}).Error("failed to ip from cidr")
} else {
reserverIps = append(reserverIps, ip)
reservedIps = append(reservedIps, ip)
}
}
}
}

return reserverIps, nil
return reservedIps, nil
}

// ReadVPN vpn by id
Expand Down

0 comments on commit e82fa32

Please sign in to comment.