diff options
author | Faicker Mo <faicker.mo@ucloud.cn> | 2019-10-30 14:55:00 +0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-11-01 20:42:56 +0900 |
commit | cd4fee488042717bd4377f3419b0621eac6f0717 (patch) | |
tree | 2928ed29fe67f010a0a832e16a074b205698132b /pkg | |
parent | ef3a9674abef7a032d6ea9644347385e908f06f4 (diff) |
bgp: fix dynamic neighbors with prefix "0.0.0.0/0"
support prefix "0.0.0.0/0".
Signed-off-by: Faicker Mo <faicker.mo@ucloud.cn>
Diffstat (limited to 'pkg')
-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 } |