summaryrefslogtreecommitdiffstats
path: root/src/vnet/config.c
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2018-05-15 15:51:30 -0500
committerDave Wallace <dwallacelf@gmail.com>2018-05-17 16:31:15 +0000
commitc3267ed944b47c5894be916cb9a440413b8802f8 (patch)
treebea8ae35fd16cafe1cf7c508c549d76bd5a07062 /src/vnet/config.c
parent19be50ed9f7dc838f6c5720de9b5df6ef36b0cf3 (diff)
Fix failure during enable/disable of features
vnet_feature_enable_disable_with_index() checks the return status of vnet_config_{add,del}_feature(). If the config string heap index returned is the same index that was in use prior to the add/delete, it is concluded that a failure occurred and processing of the feature stops. Sometimes the config index that is returned can legitimately be the same index that was in used before the add/delete. The old list of features can have its heap entry deallocated before a new entry for the new list is allocated. The heap entry for the new list can be the entry that was deallocated while deleting the old one. Make vnet_config_{add,del}_feature() return ~0 on failure. Look for that return value as an indication that an error occurred in vnet_enable_disable_feature_by_index(). Change-Id: I88bb3ff88a76971c1b5e5ece74784ce8ba78373c Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src/vnet/config.c')
-rw-r--r--src/vnet/config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vnet/config.c b/src/vnet/config.c
index 03189d77cd5..26b0cad6055 100644
--- a/src/vnet/config.c
+++ b/src/vnet/config.c
@@ -247,7 +247,7 @@ vnet_config_add_feature (vlib_main_t * vm,
u32 node_index = vec_elt (cm->node_index_by_feature_index, feature_index);
if (node_index == ~0) // feature node does not exist
- return config_string_heap_index; // return original config index
+ return ~0;
if (config_string_heap_index == ~0)
{
@@ -330,7 +330,7 @@ vnet_config_del_feature (vlib_main_t * vm,
/* Feature not found. */
if (f >= vec_end (old->features))
- return config_string_heap_index; // return original config index
+ return ~0;
new_features = duplicate_feature_vector (old->features);
f = new_features + (f - old->features);