summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-11-15 22:47:37 +0100
committerAndrew Yourtchenko <ayourtch@gmail.com>2023-11-16 20:33:31 +0000
commit862097a16693d5911b22fb41c8409577db674438 (patch)
tree830bd59f96632605cfa6ce0a3e7b2fa212a102ad
parent69768d99eed0f44f6955370cb1ad83b8b73e5368 (diff)
dev: startup.conf handling improvements
Type: improvement Change-Id: I74fb01061b4949d68ec39d0b7d08e6df8dc44b98 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/vnet/dev/config.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/vnet/dev/config.c b/src/vnet/dev/config.c
index 3026eaadca7..65238710271 100644
--- a/src/vnet/dev/config.c
+++ b/src/vnet/dev/config.c
@@ -113,11 +113,11 @@ vnet_dev_config_one_device (vlib_main_t *vm, unformat_input_t *input,
if (rv != VNET_DEV_OK)
break;
}
-
- if (rv != VNET_DEV_OK)
- err = clib_error_return (0, "error: %U for device '%s'",
- format_vnet_dev_rv, rv, device_id);
}
+
+ if (rv != VNET_DEV_OK)
+ err = clib_error_return (0, "error: %U for device '%s'",
+ format_vnet_dev_rv, rv, device_id);
}
vec_free (if_args_vec);
@@ -138,7 +138,7 @@ dev_config_process_node_fn (vlib_main_t *vm, vlib_node_runtime_t *rt,
unformat_init_vector (&input, dm->startup_config);
dm->startup_config = 0;
- while (unformat_check_input (&input) != UNFORMAT_END_OF_INPUT)
+ while (!err && unformat_check_input (&input) != UNFORMAT_END_OF_INPUT)
{
unformat_input_t sub_input;
vnet_dev_device_id_t device_id;
@@ -148,19 +148,28 @@ dev_config_process_node_fn (vlib_main_t *vm, vlib_node_runtime_t *rt,
{
err = vnet_dev_config_one_device (vm, &sub_input, device_id);
unformat_free (&sub_input);
- if (err)
- break;
}
- else
+ else if (unformat (&input, "dev %U", unformat_c_string_array, device_id,
+ sizeof (device_id)))
{
- err = clib_error_return (0, "unknown input '%U'",
- format_unformat_error, &input);
- break;
+ unformat_input_t no_input = {};
+ unformat_init_vector (&no_input, 0);
+ err = vnet_dev_config_one_device (vm, &no_input, device_id);
+ unformat_free (&no_input);
}
+ else
+ err = clib_error_return (0, "unknown input '%U'",
+ format_unformat_error, &input);
}
unformat_free (&input);
+ if (err)
+ {
+ log_err (0, "%U", format_clib_error, err);
+ clib_error_free (err);
+ }
+
vlib_node_set_state (vm, rt->node_index, VLIB_NODE_STATE_DISABLED);
vlib_node_rename (vm, rt->node_index, "deleted-%u", rt->node_index);
vec_add1 (dm->free_process_node_indices, rt->node_index);