From 3ecc221162d644884048014dbd399a1f78b89700 Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Tue, 27 Mar 2018 10:34:43 +0200 Subject: reassembly: bug fixes This change fixes a bug which would corrupt features infra by making feature infra resistant to double-removal. It also fixes 'out of memory' issue by properly initializing the bihash tables. Change-Id: I78ac03139234a9a0e0b48e7bdfac1c38a0069e82 Signed-off-by: Klement Sekera --- src/vnet/ip/ip4_reassembly.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/vnet/ip/ip4_reassembly.c') diff --git a/src/vnet/ip/ip4_reassembly.c b/src/vnet/ip/ip4_reassembly.c index b94a25819b7..33cdbd5e04d 100644 --- a/src/vnet/ip/ip4_reassembly.c +++ b/src/vnet/ip/ip4_reassembly.c @@ -1110,8 +1110,7 @@ ip4_reass_set (u32 timeout_ms, u32 max_reassemblies, ip4_reass_main.ip4_reass_expire_node_idx, IP4_EVENT_CONFIG_CHANGED, 0); u32 new_nbuckets = ip4_reass_get_nbuckets (); - if (ip4_reass_main.max_reass_n > 0 && new_nbuckets > 1 && - new_nbuckets != old_nbuckets) + if (ip4_reass_main.max_reass_n > 0 && new_nbuckets > old_nbuckets) { clib_bihash_24_8_t new_hash; memset (&new_hash, 0, sizeof (new_hash)); @@ -1170,6 +1169,10 @@ ip4_reass_init_function (vlib_main_t * vm) ASSERT (node); rm->ip4_reass_expire_node_idx = node->index; + ip4_reass_set_params (IP4_REASS_TIMEOUT_DEFAULT_MS, + IP4_REASS_MAX_REASSEMBLIES_DEFAULT, + IP4_REASS_EXPIRE_WALK_INTERVAL_DEFAULT_MS); + nbuckets = ip4_reass_get_nbuckets (); clib_bihash_init_24_8 (&rm->hash, "ip4-reass", nbuckets, nbuckets * 1024); @@ -1177,10 +1180,6 @@ ip4_reass_init_function (vlib_main_t * vm) ASSERT (node); rm->ip4_drop_idx = node->index; - ip4_reass_set_params (IP4_REASS_TIMEOUT_DEFAULT_MS, - IP4_REASS_MAX_REASSEMBLIES_DEFAULT, - IP4_REASS_EXPIRE_WALK_INTERVAL_DEFAULT_MS); - return error; } -- cgit 1.2.3-korg