summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-02-05 09:45:43 -0500
committerFlorin Coras <florin.coras@gmail.com>2018-02-05 16:09:31 +0000
commit1403fcd7ec2da72334f5df20f0b7e6dbba24d856 (patch)
treeb4bbf1a7050a531823f02a99523be42285cac39e /src/vnet
parent21c8baf9a77b49af3dd54a7f64ce34dc932f10c3 (diff)
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 <dave@barachs.net>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ip/ip4_reassembly.c12
-rw-r--r--src/vnet/ip/ip6_reassembly.c11
2 files changed, 15 insertions, 8 deletions
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;