summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
authorBen Agricola <bagricola@squiz.co.uk>2016-07-01 16:33:33 +0100
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-07-11 18:52:33 +0900
commitdcdc6f7a05419d211590a6ac9fc60d41efea0dbe (patch)
tree6f21f78bdc9c630f9e1205dc360af05eba0c4e95 /server/server.go
parentc40f64c235fa9ed532cdcc98b61c14a72d17d298 (diff)
Fix longer-prefix search using radix trie walk
Bug-Url: #1006 Signed-off-by: Ben Agricola <bagricola@squiz.co.uk>
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/server.go b/server/server.go
index 0bee727e..6a766261 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1619,10 +1619,11 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) {
}
} else if dst.LongerPrefixes {
_, prefix, _ := net.ParseCIDR(key)
- ones, bits := prefix.Mask.Size()
- for i := ones + 1; i <= bits; i++ {
- prefix.Mask = net.CIDRMask(i, bits)
- f(id, prefix.String())
+
+ for _, dst := range rib.Tables[af].GetLongerPrefixDestinations(prefix.String()) {
+ if d := dst.ToApiStruct(id); d != nil {
+ dsts = append(dsts, d)
+ }
}
}
}