From 5a1b3fb5ae7a7a1253de8039eb6d5f9798c55c82 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 12 Jan 2018 09:55:28 -0500 Subject: [PATCH] bgpd: Fix some evpn hash key creation The creation of a hash key should use a jhash function instead of adding the char's together. Signed-off-by: Donald Sharp --- bgpd/bgp_evpn.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 12cc425bd3..824b72b240 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -99,19 +99,8 @@ static unsigned int vrf_import_rt_hash_key_make(void *p) { struct vrf_irt_node *irt = p; char *pnt = irt->rt.val; - unsigned int key = 0; - int c = 0; - - key += pnt[c]; - key += pnt[c + 1]; - key += pnt[c + 2]; - key += pnt[c + 3]; - key += pnt[c + 4]; - key += pnt[c + 5]; - key += pnt[c + 6]; - key += pnt[c + 7]; - - return key; + + return jhash(pnt, 8, 0x5abc1234); } /* @@ -224,19 +213,8 @@ static unsigned int import_rt_hash_key_make(void *p) { struct irt_node *irt = p; char *pnt = irt->rt.val; - unsigned int key = 0; - int c = 0; - - key += pnt[c]; - key += pnt[c + 1]; - key += pnt[c + 2]; - key += pnt[c + 3]; - key += pnt[c + 4]; - key += pnt[c + 5]; - key += pnt[c + 6]; - key += pnt[c + 7]; - - return (key); + + return jhash(pnt, 8, 0xdeadbeef); } /* -- 2.39.5