diff options
Diffstat (limited to 'vnet/vnet/flow/flow_report_classify.c')
-rw-r--r-- | vnet/vnet/flow/flow_report_classify.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/vnet/vnet/flow/flow_report_classify.c b/vnet/vnet/flow/flow_report_classify.c index 95403793cfe..cb8fe069681 100644 --- a/vnet/vnet/flow/flow_report_classify.c +++ b/vnet/vnet/flow/flow_report_classify.c @@ -391,9 +391,10 @@ ipfix_classify_table_add_del_command_fn (vlib_main_t * vm, ipfix_classify_table_t * table; int rv; int is_add = -1; - u32 classify_table_index; + u32 classify_table_index = ~0; u8 ip_version = 0; u8 transport_protocol = 255; + clib_error_t * error = 0; if (fcm->src_port == 0) clib_error_return (0, "call 'set ipfix classify stream' first"); @@ -458,31 +459,13 @@ ipfix_classify_table_add_del_command_fn (vlib_main_t * vm, rv = vnet_flow_report_add_del (frm, &args); - switch (rv) - { - case 0: - break; - case VNET_API_ERROR_NO_SUCH_ENTRY: - return clib_error_return (0, "Flow report not found"); - case VNET_API_ERROR_VALUE_EXIST: - return clib_error_return (0, "Flow report already exists"); - case VNET_API_ERROR_INVALID_VALUE: - return clib_error_return (0, "Expecting either still unused values " - "for both domain_id and src_port " - "or already used values for both fields"); - default: - return clib_error_return (0, "vnet_flow_report_add_del returned %d", rv); - } + error = flow_report_add_del_error_to_clib_error(rv); - if (is_add) { - if (rv != 0) - ipfix_classify_delete_table(table - fcm->tables); - } else { - if (rv == 0) - ipfix_classify_delete_table(table - fcm->tables); - } + /* If deleting, or add failed */ + if (is_add == 0 || (rv && is_add)) + ipfix_classify_delete_table (table - fcm->tables); - return 0; + return error; } VLIB_CLI_COMMAND (ipfix_classify_table_add_del_command, static) = { |