summaryrefslogtreecommitdiffhomepage
path: root/table/table.go
diff options
context:
space:
mode:
Diffstat (limited to 'table/table.go')
-rw-r--r--table/table.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/table/table.go b/table/table.go
index f60c2dfb..6f2f23eb 100644
--- a/table/table.go
+++ b/table/table.go
@@ -30,6 +30,7 @@ type Table interface {
tableKey(nlri bgp.AddrPrefixInterface) net.IP
validatePath(path Path)
validateNlri(nlri bgp.AddrPrefixInterface)
+ DeleteDestByPeer(*PeerInfo) []Destination
}
type TableDefault struct {
@@ -92,6 +93,23 @@ func (td *TableDefault) cleanUninterestingPaths(interested_rts) int {
}
*/
+func (td *TableDefault) DeleteDestByPeer(peerInfo *PeerInfo) []Destination {
+ changedDests := make([]Destination, 0)
+ for _, dest := range td.destinations {
+ newKnownPathList := make([]Path, 0)
+ for _, p := range dest.getKnownPathList() {
+ if peerInfo != p.getSource() || peerInfo.VersionNum != p.getSourceVerNum() {
+ newKnownPathList = append(newKnownPathList, p)
+ }
+ }
+ if len(newKnownPathList) != len(dest.getKnownPathList()) {
+ changedDests = append(changedDests, dest)
+ dest.setKnownPathList(newKnownPathList)
+ }
+ }
+ return changedDests
+}
+
func deleteDestByNlri(table Table, nlri bgp.AddrPrefixInterface) Destination {
table.validateNlri(nlri)
destinations := table.getDestinations()