diff options
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/server/server.go b/server/server.go index 089d8e0a..2bb89d8e 100644 --- a/server/server.go +++ b/server/server.go @@ -1441,27 +1441,24 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { } for _, dst := range arg.Destinations { key := dst.Prefix - y, err := f(key) - if err != nil { + if _, err := f(key); err != nil { if host := net.ParseIP(key); host != nil { masklen := 32 if af == bgp.RF_IPv6_UC { masklen = 128 } for i := masklen; i > 0; i-- { - if y, _ = f(fmt.Sprintf("%s/%d", key, i)); y { + if y, _ := f(fmt.Sprintf("%s/%d", key, i)); y { break } } } - } else if !y && dst.LongerPrefix { + } 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) - if y, _ = f(prefix.String()); y { - break - } + f(prefix.String()) } } } |