Skip to content
Snippets Groups Projects
Commit 8522e20c authored by Maximilian Wilhelm's avatar Maximilian Wilhelm
Browse files

Set OriginatorID and ClusterList for route reflector clients if required.

parent 7ee75ef7
No related branches found
No related tags found
No related merge requests found
...@@ -53,8 +53,8 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error { ...@@ -53,8 +53,8 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error {
return nil return nil
} }
// Don't export routes learned via iBGP to an iBGP neighbor // Don't export routes learned via iBGP to an iBGP neighbor which is NOT a route reflection client
if !p.BGPPath.EBGP && a.neighbor.IBGP { if !p.BGPPath.EBGP && a.neighbor.IBGP && !a.neighbor.RouteReflectorClient {
return nil return nil
} }
...@@ -65,6 +65,27 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error { ...@@ -65,6 +65,27 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error {
p.BGPPath.NextHop = a.neighbor.LocalAddress p.BGPPath.NextHop = a.neighbor.LocalAddress
} }
// If the iBGP neighbor is a route reflection client...
if a.neighbor.IBGP && a.neighbor.RouteReflectorClient {
/*
* RFC4456 Section 8:
* 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 p.BGPPath.OriginatorID == 0 {
p.BGPPath.OriginatorID = p.BGPPath.Source.ToUint32()
}
/*
* When an RR reflects a route, it MUST prepend the local CLUSTER_ID to the CLUSTER_LIST.
* If the CLUSTER_LIST is empty, it MUST create a new one.
*/
cList := make([]uint32, len(p.BGPPath.ClusterList)+1)
copy(cList[1:], p.BGPPath.ClusterList)
cList[0] = a.neighbor.ClusterID
p.BGPPath.ClusterList = cList
}
p, reject := a.exportFilter.ProcessTerms(pfx, p) p, reject := a.exportFilter.ProcessTerms(pfx, p)
if reject { if reject {
return nil return nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment