diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-23 11:13:40 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-23 11:13:40 +0900 |
commit | 4867124319c179d2a573d465a5dff2845176fb99 (patch) | |
tree | 395c5f3b782156112c900752a5b6b4c5b964be5b /table/table.go | |
parent | 706ccc9d71b3bd7b0555bf657dc80268b79222df (diff) |
table: add Equal() method to compare PeerInfo
this patch fixes the wrong behavior shown below
$ gobgp global rib add 10.0.0.0/24
$ gobgp global rib del 10.0.0.0/24
$ gobgp global rib
Network Next Hop AS_PATH Age Attrs
*> 10.0.0.0/24 0.0.0.0 65000 00:05:48 [{Origin: IGP}]
since we used to compare path's source by PeerInfo's pointer, locally
originated routes is considered as a different route even if they have
same prefix.
this patch introduce Equal() method to compare PeerInfo's content and
fix this wrong behavior.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/table.go')
-rw-r--r-- | table/table.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/table/table.go b/table/table.go index 22499f5a..7fa6b17a 100644 --- a/table/table.go +++ b/table/table.go @@ -98,7 +98,7 @@ func (td *TableDefault) DeleteDestByPeer(peerInfo *PeerInfo) []Destination { for _, dest := range td.destinations { newKnownPathList := make([]Path, 0) for _, p := range dest.getKnownPathList() { - if p.GetSource() != peerInfo { + if !p.GetSource().Equal(peerInfo) { newKnownPathList = append(newKnownPathList, p) } } |