summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
Diffstat (limited to 'table')
-rw-r--r--table/path.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/table/path.go b/table/path.go
index eefc2780..77b811d1 100644
--- a/table/path.go
+++ b/table/path.go
@@ -835,5 +835,21 @@ func (path *Path) GetOrigin() (uint8, error) {
}
func (lhs *Path) Equal(rhs *Path) bool {
- return lhs == rhs
+ if rhs == nil {
+ return false
+ }
+
+ if lhs.GetSource() != rhs.GetSource() {
+ return false
+ }
+
+ pattrs := func(arg []bgp.PathAttributeInterface) []byte {
+ ret := make([]byte, 0)
+ for _, a := range arg {
+ aa, _ := a.Serialize()
+ ret = append(ret, aa...)
+ }
+ return ret
+ }
+ return bytes.Equal(pattrs(lhs.GetPathAttrs()), pattrs(rhs.GetPathAttrs()))
}