summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorFaicker Mo <faicker.mo@ucloud.cn>2019-10-30 14:55:00 +0800
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-11-01 20:42:56 +0900
commitcd4fee488042717bd4377f3419b0621eac6f0717 (patch)
tree2928ed29fe67f010a0a832e16a074b205698132b /pkg
parentef3a9674abef7a032d6ea9644347385e908f06f4 (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.go3
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
}