summaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/CMakeLists.txt
blob: c099060a1dec7da10e4adf0c6510fc7b47999938 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright (c) 2018 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

add_vpp_plugin(gbp
  SOURCES
  gbp_subnet.c
  gbp_contract.c
  gbp_endpoint.c
  gbp_endpoint_group.c
  gbp_classify.c
  gbp_recirc.c
  gbp_policy.c
  gbp_policy_dpo.c
  gbp_fwd.c
  gbp_fwd_dpo.c
  gbp_api.c

  API_FILES
  gbp.api

  INSTALL_HEADERS
  gbp.h
  gbp_all_api_h.h
  gbp_msg_enum.h
)
cnat_client_db.crd_cip4));
- ASSERT (0 == pool_elts (cnat_client_pool));
- for (int i = 0; i < nthreads; i++)
- {
- ASSERT (0 == pool_elts (cnat_client_db.throttle_pool[i]));
- }
- return (0);
+ int rv = 0, rrv = 0;
+ if ((rv = hash_elts (cnat_client_db.crd_cip6)))
+ clib_warning ("len(crd_cip6) isnt 0 but %d", rv);
+ rrv |= rv;
+ if ((rv = hash_elts (cnat_client_db.crd_cip4)))
+ clib_warning ("len(crd_cip4) isnt 0 but %d", rv);
+ rrv |= rv;
+ if ((rv = pool_elts (cnat_client_pool)))
+ clib_warning ("len(cnat_client_pool) isnt 0 but %d", rv);
+ rrv |= rv;
+ if ((rv = hash_elts (cnat_client_db.throttle_mem)))
+ clib_warning ("len(throttle_mem) isnt 0 but %d", rv);
+ rrv |= rv;
+ return (rrv);
}
u8 *
@@ -265,8 +254,6 @@ format_cnat_client (u8 * s, va_list * args)
s = format (s, "[%d] cnat-client:[%U] tr:%d sess:%d", cci,
format_ip_address, &cc->cc_ip,
cc->tr_refcnt, cc->session_refcnt);
- if (cc->flags & CNAT_FLAG_EXPIRES)
- s = format (s, " expires");
if (cc->flags & CNAT_FLAG_EXCLUSIVE)
s = format (s, " exclusive");
@@ -300,10 +287,8 @@ cnat_client_show (vlib_main_t * vm,
if (INDEX_INVALID == cci)
{
- /* *INDENT-OFF* */
pool_foreach_index (cci, cnat_client_pool)
vlib_cli_output(vm, "%U", format_cnat_client, cci, 0);
- /* *INDENT-ON* */
vlib_cli_output (vm, "%d clients", pool_elts (cnat_client_pool));
vlib_cli_output (vm, "%d timestamps", pool_elts (cnat_timestamps));
@@ -362,6 +347,7 @@ cnat_client_dpo_unlock (dpo_id_t * dpo)
if (0 == cc->cc_locks)
{
ASSERT (cnat_client_is_clone (cc));
+ dpo_reset (&cc->cc_parent);
pool_put (cnat_client_pool, cc);
}
}
@@ -387,9 +373,6 @@ const static dpo_vft_t cnat_client_dpo_vft = {
static clib_error_t *
cnat_client_init (vlib_main_t * vm)
{
- vlib_thread_main_t *tm = vlib_get_thread_main ();
- int nthreads = tm->n_threads + 1;
- int i;
cnat_client_dpo = dpo_register_new_type (&cnat_client_dpo_vft,
cnat_client_dpo_nodes);
@@ -397,10 +380,9 @@ cnat_client_init (vlib_main_t * vm)
sizeof (ip6_address_t),
sizeof (uword));
- vec_validate (cnat_client_db.throttle_pool, nthreads);
- vec_validate (cnat_client_db.throttle_pool_lock, nthreads);
- for (i = 0; i < nthreads; i++)
- clib_spinlock_init (&cnat_client_db.throttle_pool_lock[i]);
+ clib_spinlock_init (&cnat_client_db.throttle_lock);
+ cnat_client_db.throttle_mem =
+ hash_create_mem (0, sizeof (ip_address_t), sizeof (uword));
return (NULL);
}