- int nthreads;
- u32 *del_vec = NULL, *ai;
- ip_address_t *addr;
- nthreads = tm->n_threads + 1;
- for (int i = 0; i < nthreads; i++)
- {
- vec_reset_length (del_vec);
- clib_spinlock_lock (&cnat_client_db.throttle_pool_lock[i]);
- /* *INDENT-OFF* */
- pool_foreach (addr, cnat_client_db.throttle_pool[i]) {
- cc = (AF_IP4 == addr->version ?
- cnat_client_ip4_find (&ip_addr_v4(addr)) :
- cnat_client_ip6_find (&ip_addr_v6(addr)));
- /* Client might not already be created */
- if (NULL != cc)
- {
- cnat_client_cnt_session (cc);
- vec_add1(del_vec, addr - cnat_client_db.throttle_pool[i]);
- }
- }
- /* *INDENT-ON* */
- vec_foreach (ai, del_vec)
+ ip_address_t *addr, *del_vec = NULL;
+ u32 refcnt;
+
+ vec_reset_length (del_vec);
+ clib_spinlock_lock (&cnat_client_db.throttle_lock);
+ hash_foreach_mem (addr, refcnt, cnat_client_db.throttle_mem, {
+ cc = (AF_IP4 == addr->version ? cnat_client_ip4_find (&ip_addr_v4 (addr)) :
+ cnat_client_ip6_find (&ip_addr_v6 (addr)));
+ /* Client might not already be created */
+ if (NULL != cc)