From 2218d1bbfc29c0d5b8847af1226c9f96a10c57eb Mon Sep 17 00:00:00 2001
From: Maximilian Wilhelm <max@sdn.clinic>
Date: Tue, 3 Jul 2018 16:43:50 +0200
Subject: [PATCH] Include OriginatorID and ClusterList when computing BGPPath
 hash.

  Also update expected hash value (now includes OriginatorID + ClusterList).

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
---
 route/bgp_path.go | 2 ++
 route/bgp_test.go | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/route/bgp_path.go b/route/bgp_path.go
index b9bd1216..333758bd 100644
--- a/route/bgp_path.go
+++ b/route/bgp_path.go
@@ -331,6 +331,8 @@ func (b *BGPPath) ComputeHash() string {
 		b.BGPIdentifier,
 		b.Source,
 		b.Communities,
+		b.OriginatorID,
+		b.ClusterList,
 		b.LargeCommunities,
 		b.PathIdentifier)
 
diff --git a/route/bgp_test.go b/route/bgp_test.go
index f399d5d5..760306af 100644
--- a/route/bgp_test.go
+++ b/route/bgp_test.go
@@ -36,9 +36,9 @@ func TestComputeHash(t *testing.T) {
 		Source:         bnet.IPv4(4),
 	}
 
-	assert.Equal(t, "98d68e69d993f8807c561cc7d63de759f7edc732887f88a7ebf42f61b9e54821", p.ComputeHash())
+	assert.Equal(t, "1058916ff3e6a51c7d8a47945d13fc3fcd8ee578a6d376505f46d58979b30fae", p.ComputeHash())
 
 	p.LocalPref = 150
 
-	assert.NotEqual(t, "98d68e69d993f8807c561cc7d63de759f7edc732887f88a7ebf42f61b9e54821", p.ComputeHash())
+	assert.NotEqual(t, "1058916ff3e6a51c7d8a47945d13fc3fcd8ee578a6d376505f46d58979b30fae", p.ComputeHash())
 }
-- 
GitLab