From 1403fcd7ec2da72334f5df20f0b7e6dbba24d856 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Mon, 5 Feb 2018 09:45:43 -0500 Subject: Fix ip4/6_reass_main.ip4/6_reass_expire_node_idx used before set Add an ASSERT to vlib_process_signal_event_helper to catch future instances of passing node_index = 0 to vlib_process_signal_event(). Change-Id: Iec896fc7c3917feb2fd3198cea42851ba88e64e5 Signed-off-by: Dave Barach --- src/vnet/ip/ip4_reassembly.c | 12 ++++++++---- src/vnet/ip/ip6_reassembly.c | 11 +++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/ip/ip4_reassembly.c b/src/vnet/ip/ip4_reassembly.c index 7a10271cb44..ac3db16a3ad 100644 --- a/src/vnet/ip/ip4_reassembly.c +++ b/src/vnet/ip/ip4_reassembly.c @@ -1001,6 +1001,7 @@ ip4_reass_set (u32 timeout_ms, u32 max_reassemblies, ip4_reass_main.timeout = (f64) timeout_ms / (f64) MSEC_PER_SEC; ip4_reass_main.max_reass_n = max_reassemblies; ip4_reass_main.expire_walk_interval_ms = expire_walk_interval_ms; + vlib_process_signal_event (ip4_reass_main.vlib_main, ip4_reass_main.ip4_reass_expire_node_idx, IP4_EVENT_CONFIG_CHANGED, 0); @@ -1048,12 +1049,18 @@ ip4_reass_init_function (vlib_main_t * vm) ip4_reass_main_t *rm = &ip4_reass_main; clib_error_t *error = 0; u32 nbuckets; + vlib_node_t *node; rm->vlib_main = vm; rm->vnet_main = vnet_get_main (); rm->reass_n = 0; pool_alloc (rm->pool, rm->max_reass_n); + + node = vlib_get_node_by_name (vm, (u8 *) "ip4-reassembly-expire-walk"); + ASSERT (node); + rm->ip4_reass_expire_node_idx = node->index; + ip4_reass_set (IP4_REASS_TIMEOUT_DEFAULT_MS, IP4_REASS_MAX_REASSEMBLIES_DEAFULT, IP4_REASS_EXPIRE_WALK_INTERVAL_DEFAULT_MS); @@ -1061,12 +1068,9 @@ ip4_reass_init_function (vlib_main_t * vm) nbuckets = ip4_reass_get_nbuckets (); clib_bihash_init_24_8 (&rm->hash, "ip4-reass", nbuckets, nbuckets * 1024); - vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "ip4-drop"); + node = vlib_get_node_by_name (vm, (u8 *) "ip4-drop"); ASSERT (node); rm->ip4_drop_idx = node->index; - node = vlib_get_node_by_name (vm, (u8 *) "ip4-reassembly-expire-walk"); - ASSERT (node); - rm->ip4_reass_expire_node_idx = node->index; return error; } diff --git a/src/vnet/ip/ip6_reassembly.c b/src/vnet/ip/ip6_reassembly.c index 5a7c081055b..df9c4fbcdf8 100644 --- a/src/vnet/ip/ip6_reassembly.c +++ b/src/vnet/ip/ip6_reassembly.c @@ -1064,12 +1064,18 @@ ip6_reass_init_function (vlib_main_t * vm) ip6_reass_main_t *rm = &ip6_reass_main; clib_error_t *error = 0; u32 nbuckets; + vlib_node_t *node; rm->vlib_main = vm; rm->vnet_main = vnet_get_main (); rm->reass_n = 0; pool_alloc (rm->pool, rm->max_reass_n); + + node = vlib_get_node_by_name (vm, (u8 *) "ip6-reassembly-expire-walk"); + ASSERT (node); + rm->ip6_reass_expire_node_idx = node->index; + ip6_reass_set (IP6_REASS_TIMEOUT_DEFAULT_MS, IP6_REASS_MAX_REASSEMBLIES_DEAFULT, IP6_REASS_EXPIRE_WALK_INTERVAL_DEFAULT_MS); @@ -1077,12 +1083,9 @@ ip6_reass_init_function (vlib_main_t * vm) nbuckets = ip6_reass_get_nbuckets (); clib_bihash_init_48_8 (&rm->hash, "ip6-reass", nbuckets, nbuckets * 1024); - vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "ip6-drop"); + node = vlib_get_node_by_name (vm, (u8 *) "ip6-drop"); ASSERT (node); rm->ip6_drop_idx = node->index; - node = vlib_get_node_by_name (vm, (u8 *) "ip6-reassembly-expire-walk"); - ASSERT (node); - rm->ip6_reass_expire_node_idx = node->index; node = vlib_get_node_by_name (vm, (u8 *) "ip6-icmp-error"); ASSERT (node); rm->ip6_icmp_error_idx = node->index; -- cgit 1.2.3-korg