From 31342564c9e7a78a183f11dd637e36c08e0f274b Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Sat, 21 May 2016 14:58:57 +0000 Subject: table: fix UpdatePathAttrs() to obey RFC4684 Signed-off-by: ISHIDA Wataru --- table/path.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/table/path.go b/table/path.go index cefe974f..3742970f 100644 --- a/table/path.go +++ b/table/path.go @@ -214,7 +214,16 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor) if peer.RouteReflector.Config.RouteReflectorClient { // This attribute will carry the BGP Identifier of the originator of the route in the local AS. // A BGP speaker SHOULD NOT create an ORIGINATOR_ID attribute if one already exists. - if path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGINATOR_ID) == nil { + // + // RFC4684 3.2 Intra-AS VPN Route Distribution + // When advertising RT membership NLRI to a route-reflector client, + // the Originator attribute shall be set to the router-id of the + // advertiser, and the Next-hop attribute shall be set of the local + // address for that session. + if path.GetRouteFamily() == bgp.RF_RTC_UC { + path.SetNexthop(localAddress) + path.setPathAttr(bgp.NewPathAttributeOriginatorId(info.LocalID.String())) + } else if path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGINATOR_ID) == nil { path.setPathAttr(bgp.NewPathAttributeOriginatorId(info.ID.String())) } // When an RR reflects a route, it MUST prepend the local CLUSTER_ID to the CLUSTER_LIST. -- cgit v1.2.3