From b2fb1ae851525fd7268123fe0cc92ba5144b1d6e Mon Sep 17 00:00:00 2001 From: Chris Randles Date: Tue, 31 Mar 2020 18:29:38 -0400 Subject: [PATCH] range_end should be treated as inclusive when iterating for ip assignments --- go.mod | 1 + pkg/allocate/allocate.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 94fe216bf..949d6aac7 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/pkg/allocate/allocate.go b/pkg/allocate/allocate.go index 3dbad81be..84970c0e6 100644 --- a/pkg/allocate/allocate.go +++ b/pkg/allocate/allocate.go @@ -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)