aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/feature/feature.c
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-11-06 13:25:17 -0500
committerDamjan Marion <dmarion@me.com>2019-12-17 18:26:59 +0000
commita4e2e7cc95250220e0d892eb11dcc0adc9fd7e22 (patch)
treef87002418ae1d0eeabd09e1a6af52b1cd58b76bf /src/vnet/feature/feature.c
parentbaa171041bc950f192c147f7b79a8add2299b74a (diff)
feature: add descriptive cli command output for 'set interface feature'
DBGvpp# set interface feature local0 arp-foo arc bad-arc set interface feature: Unknown arc name (bad-arc)... DBGvpp# set interface feature local0 arp-foo arc arp set interface feature: Feature (arp-foo) not registered to arc (arp)... See 'show features verbose' for valid feature/arc combinations. DBGvpp# set interface feature local0 arp-disabled arc arp Type: fix Change-Id: I036bb2a75dd2d40f6901e4fde3eb14925238e19b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'src/vnet/feature/feature.c')
-rw-r--r--src/vnet/feature/feature.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/vnet/feature/feature.c b/src/vnet/feature/feature.c
index fd884261258..0f0bfeb11d2 100644
--- a/src/vnet/feature/feature.c
+++ b/src/vnet/feature/feature.c
@@ -490,21 +490,22 @@ set_interface_features_command_fn (vlib_main_t * vm,
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat
- (line_input, "%U %v", unformat_vnet_sw_interface, vnm, &sw_if_index,
- &feature_name))
- ;
- else if (unformat (line_input, "arc %v", &arc_name))
+ (line_input, "%U %s arc %s", unformat_vnet_sw_interface, vnm,
+ &sw_if_index, &feature_name, &arc_name))
;
else if (unformat (line_input, "disable"))
enable = 0;
else
{
- if (feature_name && arc_name)
- break;
error = unformat_parse_error (line_input);
goto done;
}
}
+ if (!feature_name || !arc_name)
+ {
+ error = clib_error_return (0, "Both feature name and arc required...");
+ goto done;
+ }
if (sw_if_index == ~0)
{
@@ -515,13 +516,28 @@ set_interface_features_command_fn (vlib_main_t * vm,
vec_add1 (arc_name, 0);
vec_add1 (feature_name, 0);
+ u8 arc_index;
+
+ arc_index = vnet_get_feature_arc_index ((const char *) arc_name);
+
+ if (arc_index == (u8) ~ 0)
+ {
+ error =
+ clib_error_return (0, "Unknown arc name (%s)... ",
+ (const char *) arc_name);
+ goto done;
+ }
+
vnet_feature_registration_t *reg;
reg =
vnet_get_feature_reg ((const char *) arc_name,
(const char *) feature_name);
if (reg == 0)
{
- error = clib_error_return (0, "Unknown feature...");
+ error =
+ clib_error_return (0,
+ "Feature (%s) not registered to arc (%s)... See 'show features verbose' for valid feature/arc combinations. ",
+ feature_name, arc_name);
goto done;
}
if (reg->enable_disable_cb)