From 6042d28155a5470827c9756b39a405fe4e2cd84b Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Wed, 5 Aug 2020 17:04:06 -0500 Subject: vrrp: change init of vrrp key in VR lookup Type: fix A struct that is used as a hash key was being initialized in its declaration. On CentOS 8 this caused some hash lookups to fail. This seems to be caused by uninitialized padding. Use clib_memset() to initialize the key with 0's to avoid the issue. Change-Id: I00555c201a1ab34133971313ba14f20f4e867a30 Signed-off-by: Matthew Smith --- src/plugins/vrrp/vrrp.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/vrrp/vrrp.h b/src/plugins/vrrp/vrrp.h index 9c636c42802..0eda5d66164 100644 --- a/src/plugins/vrrp/vrrp.h +++ b/src/plugins/vrrp/vrrp.h @@ -230,13 +230,15 @@ always_inline vrrp_vr_t * vrrp_vr_lookup (u32 sw_if_index, u8 vr_id, u8 is_ipv6) { vrrp_main_t *vmp = &vrrp_main; - vrrp_vr_key_t key = { - .sw_if_index = sw_if_index, - .vr_id = vr_id, - .is_ipv6 = (is_ipv6 != 0), - }; + vrrp_vr_key_t key; uword *p; + clib_memset (&key, 0, sizeof (key)); + + key.sw_if_index = sw_if_index; + key.vr_id = vr_id; + key.is_ipv6 = (is_ipv6 != 0); + p = mhash_get (&vmp->vr_index_by_key, &key); if (p) return pool_elt_at_index (vmp->vrs, p[0]); -- cgit 1.2.3-korg