Skip to content

Commit

Permalink
Merge pull request #36 from crandles/inclusive-range-end
Browse files Browse the repository at this point in the history
range_end should be treated as inclusive when iterating for ip assignments
  • Loading branch information
crandles authored Apr 27, 2020
2 parents d559a15 + b2fb1ae commit 9e4ea85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/go-logr/logr v0.1.0
github.com/gogo/protobuf v1.2.1 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/uuid v1.1.1 // indirect
Expand Down
4 changes: 3 additions & 1 deletion pkg/allocate/allocate.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ func IterateForAssignment(ipnet net.IPNet, rangeStart net.IP, rangeEnd net.IP, r
firstip := rangeStart
var lastip net.IP
if rangeEnd != nil {
lastip = rangeEnd
end := IPToBigInt(rangeEnd)
end = end.Add(end, big.NewInt(1))
lastip = BigIntToIP(*end)
} else {
var err error
_, lastip, err = GetIPRange(rangeStart, ipnet)
Expand Down

0 comments on commit 9e4ea85

Please sign in to comment.