summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
Diffstat (limited to 'table')
-rw-r--r--table/table.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/table/table.go b/table/table.go
index c3b48812..486f0894 100644
--- a/table/table.go
+++ b/table/table.go
@@ -387,7 +387,11 @@ func (t *Table) Select(option ...TableSelectOption) (*Table, error) {
masklen = 128
}
for i := masklen; i > 0; i-- {
- if f(fmt.Sprintf("%s/%d", key, i)) {
+ _, prefix, err := net.ParseCIDR(fmt.Sprintf("%s/%d", key, i))
+ if err != nil {
+ return nil, err
+ }
+ if f(prefix.String()) {
break
}
}