diff options
author | Matthew Smith <mgsmith@netgate.com> | 2020-08-05 17:04:06 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-08-07 17:06:21 +0000 |
commit | 6042d28155a5470827c9756b39a405fe4e2cd84b (patch) | |
tree | f69e207d27c7daf141adba6970f3164fd4839de5 /src/plugins/vrrp | |
parent | 35050289e6b5f6e2939b1d08ed058ab952468943 (diff) |
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>
Diffstat (limited to 'src/plugins/vrrp')
-rw-r--r-- | src/plugins/vrrp/vrrp.h | 12 |
1 files 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]); |