diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-04-16 15:52:50 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-05-28 09:30:05 +0900 |
commit | 8e23e93af6dfefb67d34c7b24779d4c7c6323558 (patch) | |
tree | 9e6bf4fe261c515c7beb1b2eef17eddc76cb104f | |
parent | d9ed5fcc1140916688903d288a4f8e2ba2bf12a6 (diff) |
server: Apply rtfilter on eBGP session
The outgoing Route Target Constraint filter should be applied to eBGP
session, but currently applied to only iBGP session.
This patch fixes to apply rtfilter on eBGP session.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
-rw-r--r-- | server/server.go | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/server/server.go b/server/server.go index ceaef726..a6015d8e 100644 --- a/server/server.go +++ b/server/server.go @@ -359,35 +359,35 @@ func filterpath(peer *Peer, path, old *table.Path) *table.Path { return nil } - //iBGP handling - if peer.isIBGPPeer() { - ignore := false - //RFC4684 Constrained Route Distribution - if _, y := peer.fsm.rfMap[bgp.RF_RTC_UC]; y && path.GetRouteFamily() != bgp.RF_RTC_UC { - ignore = true - for _, ext := range path.GetExtCommunities() { - 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 - } - } - if !ignore { + //RFC4684 Constrained Route Distribution + if _, y := peer.fsm.rfMap[bgp.RF_RTC_UC]; y && path.GetRouteFamily() != bgp.RF_RTC_UC { + ignore := true + for _, ext := range path.GetExtCommunities() { + 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 } } - if ignore { - log.WithFields(log.Fields{ - "Topic": "Peer", - "Key": peer.ID(), - "Data": path, - }).Debug("Filtered by Route Target Constraint, ignore") - return nil + if !ignore { + break } } + if ignore { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": peer.ID(), + "Data": path, + }).Debug("Filtered by Route Target Constraint, ignore") + return nil + } + } + //iBGP handling + if peer.isIBGPPeer() { + ignore := false if !path.IsLocal() { ignore = true info := path.GetSource() |