summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/server.go23
1 files changed, 15 insertions, 8 deletions
diff --git a/server/server.go b/server/server.go
index cd739594..abd32dfa 100644
--- a/server/server.go
+++ b/server/server.go
@@ -363,11 +363,10 @@ func filterpath(peer *Peer, path, old *table.Path) *table.Path {
if _, y := peer.fsm.rfMap[bgp.RF_RTC_UC]; y && path.GetRouteFamily() != bgp.RF_RTC_UC {
ignore = true
for _, ext := range path.GetExtCommunities() {
- for _, path := range peer.adjRibIn.PathList([]bgp.RouteFamily{bgp.RF_RTC_UC}, true) {
- rt := path.GetNlri().(*bgp.RouteTargetMembershipNLRI).RouteTarget
- if rt == nil {
- ignore = false
- } else if ext.String() == rt.String() {
+ for _, p := range peer.adjRibIn.PathList([]bgp.RouteFamily{bgp.RF_RTC_UC}, true) {
+ rt := p.GetNlri().(*bgp.RouteTargetMembershipNLRI).RouteTarget
+ // Note: nil RT means the default route target
+ if rt == nil || ext.String() == rt.String() {
ignore = false
break
}
@@ -376,6 +375,14 @@ func filterpath(peer *Peer, path, old *table.Path) *table.Path {
break
}
}
+ if ignore {
+ log.WithFields(log.Fields{
+ "Topic": "Peer",
+ "Key": peer.ID(),
+ "Data": path,
+ }).Debug("Filtered by Route Target Constraint, ignore")
+ return nil
+ }
}
if !path.IsLocal() {
@@ -404,12 +411,12 @@ func filterpath(peer *Peer, path, old *table.Path) *table.Path {
// RFC4456 8. Avoiding Routing Information Loops
// If the local CLUSTER_ID is found in the CLUSTER_LIST,
// the advertisement received SHOULD be ignored.
- for _, clusterId := range path.GetClusterList() {
- if clusterId.Equal(peer.fsm.peerInfo.RouteReflectorClusterID) {
+ for _, clusterID := range path.GetClusterList() {
+ if clusterID.Equal(peer.fsm.peerInfo.RouteReflectorClusterID) {
log.WithFields(log.Fields{
"Topic": "Peer",
"Key": peer.ID(),
- "ClusterID": clusterId,
+ "ClusterID": clusterID,
"Data": path,
}).Debug("cluster list path attribute has local cluster id, ignore")
return nil