summaryrefslogtreecommitdiffhomepage
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/util.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/config/util.go b/config/util.go
index ce49ff63..aa393f14 100644
--- a/config/util.go
+++ b/config/util.go
@@ -247,25 +247,25 @@ func ParseMaskLength(prefix, mask string) (int, int, error) {
return 0, 0, fmt.Errorf("invalid mask length range: %s", mask)
}
// we've already checked the range is sane by regexp
- min, _ := strconv.Atoi(elems[1])
- max, _ := strconv.Atoi(elems[2])
+ min, _ := strconv.ParseUint(elems[1], 10, 8)
+ max, _ := strconv.ParseUint(elems[2], 10, 8)
if min > max {
return 0, 0, fmt.Errorf("invalid mask length range: %s", mask)
}
if ipv4 := ipNet.IP.To4(); ipv4 != nil {
- f := func(i int) bool {
- return i >= 0 && i <= 32
+ f := func(i uint64) bool {
+ return i <= 32
}
if !f(min) || !f(max) {
return 0, 0, fmt.Errorf("ipv4 mask length range outside scope :%s", mask)
}
} else {
- f := func(i int) bool {
- return i >= 0 && i <= 128
+ f := func(i uint64) bool {
+ return i <= 128
}
if !f(min) || !f(max) {
return 0, 0, fmt.Errorf("ipv6 mask length range outside scope :%s", mask)
}
}
- return min, max, nil
+ return int(min), int(max), nil
}