summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-05-21 14:58:57 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-23 09:46:53 +0900
commit31342564c9e7a78a183f11dd637e36c08e0f274b (patch)
treeefdda3407b95b0742ef52386ac4aae7a92f99804
parentb09e276561c9b36010527a25d995b962611bc655 (diff)
table: fix UpdatePathAttrs() to obey RFC4684
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r--table/path.go11
1 files changed, 10 insertions, 1 deletions
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.