ip: Replace Sematics for Interface IP addresses
[vpp.git] / src / plugins / lb / lbhash.h
index 5d2ff24..375227c 100644 (file)
@@ -84,11 +84,12 @@ lb_hash_t *lb_hash_alloc(u32 buckets, u32 timeout)
     return NULL;
 
   // Allocate 1 more bucket for prefetch
-  u32 size = ((u64)&((lb_hash_t *)(0))->buckets[0]) +
+  u32 size = ((uword)&((lb_hash_t *)(0))->buckets[0]) +
       sizeof(lb_hash_bucket_t) * (buckets + 1);
   u8 *mem = 0;
   lb_hash_t *h;
   vec_alloc_aligned(mem, size, CLIB_CACHE_LINE_BYTES);
+  clib_memset(mem, 0, size);
   h = (lb_hash_t *)mem;
   h->buckets_mask = (buckets - 1);
   h->timeout = timeout;
@@ -114,7 +115,7 @@ void lb_hash_get(lb_hash_t *ht, u32 hash, u32 vip, u32 time_now,
                 u32 *available_index, u32 *found_value)
 {
   lb_hash_bucket_t *bucket = &ht->buckets[hash & ht->buckets_mask];
-  *found_value = ~0;
+  *found_value = 0;
   *available_index = ~0;
 #if __SSE4_2__ && LB_HASH_DO_NOT_USE_SSE_BUCKETS == 0
   u32 bitmask, found_index;