summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
authorNils Juenemann <nils.juenemann+github@gmail.com>2017-03-21 20:03:24 +0100
committerGitHub <noreply@github.com>2017-03-21 20:03:24 +0100
commit61240f45b0e2d09e251dbd4176a151964e98f696 (patch)
tree7c188906e6f04cedfc11cc1885ff4201e22ed45e /table
parent448160257ea6ad41ab56a12a5a1edb5e0515cef6 (diff)
Fix for gobgp global rib <ip>
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
}
}