Skip to content
Snippets Groups Projects
Commit 8f80dc93 authored by Oliver Herms's avatar Oliver Herms
Browse files

Merge branch 'feature/sendbuffer' of github.com:bio-routing/bio-rd into feature/sendbuffer

parents 37e28661 a7130cbf
No related branches found
No related tags found
No related merge requests found
......@@ -251,15 +251,15 @@ func (b *BGPPath) Prepend(asn uint32, times uint16) {
b.ASPathLen = b.ASPath.Length()
}
func (b *BGPPath) insertNewASSequence() types.ASPath {
func (b *BGPPath) insertNewASSequence() {
pa := make(types.ASPath, len(b.ASPath)+1)
copy(pa[1:], b.ASPath)
pa[0] = types.ASPathSegment{
ASNs: make([]uint32, 0),
Type: types.ASSequence,
ASNs: make([]uint32, 0),
Type: packet.ASSequence,
}
return pa
b.ASPath = pa
}
// Copy creates a deep copy of a BGPPath
......
......@@ -69,19 +69,21 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error {
a.mu.Lock()
defer a.mu.Unlock()
if !a.neighbor.CapAddPathRX {
// AddPathRX capable neighbor
if a.neighbor.CapAddPathRX {
pathID, err := a.pathIDManager.addPath(p)
if err != nil {
return fmt.Errorf("Unable to get path ID: %v", err)
}
p.BGPPath.PathIdentifier = pathID
a.rt.AddPath(pfx, p)
} else {
// rt.ReplacePath will add this path to the rt in any case, so no rt.AddPath here!
oldPaths := a.rt.ReplacePath(pfx, p)
a.removePathsFromClients(pfx, oldPaths)
}
pathID, err := a.pathIDManager.addPath(p)
if err != nil {
return fmt.Errorf("Unable to get path ID: %v", err)
}
p.BGPPath.PathIdentifier = pathID
a.rt.AddPath(pfx, p)
for _, client := range a.ClientManager.Clients() {
err := client.AddPath(pfx, p)
if err != nil {
......@@ -166,3 +168,17 @@ func (a *AdjRIBOut) Print() string {
return ret
}
// Dump all routes present in this AdjRIBOut
func (a *AdjRIBOut) Dump() string {
a.mu.RLock()
defer a.mu.RUnlock()
ret := fmt.Sprintf("DUMPING ADJ-RIB-OUT:\n")
routes := a.rt.Dump()
for _, r := range routes {
ret += fmt.Sprintf("%s\n", r.Print())
}
return ret
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment