From cd4fee488042717bd4377f3419b0621eac6f0717 Mon Sep 17 00:00:00 2001 From: Faicker Mo Date: Wed, 30 Oct 2019 14:55:00 +0800 Subject: bgp: fix dynamic neighbors with prefix "0.0.0.0/0" support prefix "0.0.0.0/0". Signed-off-by: Faicker Mo --- pkg/server/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/server/server.go b/pkg/server/server.go index f95a988c..b8e29f6d 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -423,7 +423,8 @@ func (s *BgpServer) matchLongestDynamicNeighborPrefix(a string) *peerGroup { for _, d := range pg.dynamicNeighbors { _, netAddr, _ := net.ParseCIDR(d.Config.Prefix) if netAddr.Contains(ipAddr) { - if netAddr.Mask.String() > longestMask { + if netAddr.Mask.String() > longestMask || + (netAddr.Mask.String() == longestMask && longestMask == net.CIDRMask(0, 32).String()) { longestMask = netAddr.Mask.String() longestPG = pg } -- cgit v1.2.3