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 <mgsmith@netgate.com>
diff --git a/src/plugins/vrrp/vrrp.h b/src/plugins/vrrp/vrrp.h
index 9c636c4..0eda5d6 100644
--- a/src/plugins/vrrp/vrrp.h
+++ b/src/plugins/vrrp/vrrp.h
@@ -230,13 +230,15 @@
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]);