diff options
author | lspgn <lspgn@users.noreply.github.com> | 2017-04-20 10:20:10 +0100 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-21 17:42:06 +0900 |
commit | a766d23310fb257cce81ed28a378ac2c8dedeb44 (patch) | |
tree | 61806bb9ce55c5364cb55a2eb28e6bfcf8402961 | |
parent | 6817c29620b026a45c9ffd1d6b71bf9719c1338b (diff) |
table: Fixed bug when looking up prefixes with a default route.
-rw-r--r-- | table/table.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/table/table.go b/table/table.go index 6c5d4da8..6e90faf7 100644 --- a/table/table.go +++ b/table/table.go @@ -376,7 +376,7 @@ func (t *Table) Select(option ...TableSelectOption) (*Table, error) { return nil, err } ones, _ := prefix.Mask.Size() - for i := ones; i > 0; i-- { + for i := ones; i >= 0; i-- { _, prefix, _ := net.ParseCIDR(fmt.Sprintf("%s/%d", addr.String(), i)) f(prefix.String()) } @@ -386,7 +386,7 @@ func (t *Table) Select(option ...TableSelectOption) (*Table, error) { if t.routeFamily == bgp.RF_IPv6_UC { masklen = 128 } - for i := masklen; i > 0; i-- { + for i := masklen; i >= 0; i-- { _, prefix, err := net.ParseCIDR(fmt.Sprintf("%s/%d", key, i)) if err != nil { return nil, err |