diff options
-rw-r--r-- | pkg/server/server.go | 3 |
1 files changed, 2 insertions, 1 deletions
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 } |