- u_key.addr = l_key.addr;
- u_key.fib_index = l_key.fib_index;
- kv.key = u_key.as_u64;
-
- /* Ever heard of the "user" = src ip4 address before? */
- if (clib_bihash_search_8_8 (&tsm->user_hash, &kv, &value))
- {
- /* no, make a new one */
- pool_get (tsm->users, u);
- memset (u, 0, sizeof (*u));
- u->addr = l_key.addr;
- u->fib_index = l_key.fib_index;
-
- pool_get (tsm->list_pool, head);
- u->sessions_per_user_list_head_index = head - tsm->list_pool;
-
- clib_dlist_init (tsm->list_pool,
- u->sessions_per_user_list_head_index);
-
- kv.value = u - tsm->users;
+ u = nat_user_get_or_create (sm, &l_key.addr, l_key.fib_index,
+ thread_index);
+ if (!u)
+ {
+ clib_warning ("create NAT user failed");
+ return 0;
+ }