summaryrefslogtreecommitdiffhomepage
path: root/table/table.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-22 02:52:33 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-22 02:52:33 -0800
commit275f20e96e674e3a0b654292f81240744c61665a (patch)
tree8f4a4e6b7b0d6d31cd9e4bea00b2435f67eb8e46 /table/table.go
parentc90dc7bcf1caadb23119e638ef7ed576e1c97187 (diff)
table: send withdraw when peer is down
When a peer becomes down, send withdraw for the best pathes of it. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
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()