aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/cli.c')
-rw-r--r--hicn-plugin/src/cli.c442
1 files changed, 207 insertions, 235 deletions
diff --git a/hicn-plugin/src/cli.c b/hicn-plugin/src/cli.c
index 1adf3595c..81a97c604 100644
--- a/hicn-plugin/src/cli.c
+++ b/hicn-plugin/src/cli.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -19,7 +19,7 @@
#include <vlibmemory/api.h>
#include <vnet/udp/udp.h> // port registration
-#include <vnet/ip/ip6_packet.h> // ip46_address_t
+#include <vnet/ip/ip6_packet.h> // ip46_address_t
#include <vnet/ip/format.h>
#include <vnet/fib/fib_types.h>
@@ -51,32 +51,31 @@ typedef enum
* cli handler for 'control start'
*/
static clib_error_t *
-hicn_cli_node_ctl_start_set_command_fn (vlib_main_t * vm,
- unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_cli_node_ctl_start_set_command_fn (vlib_main_t *vm,
+ unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
int ret;
- ret = hicn_infra_plugin_enable_disable (1 /* enable */ ,
- node_ctl_params.pit_max_size,
- node_ctl_params.pit_max_lifetime_sec,
- node_ctl_params.cs_max_size, ~0);
+ ret = hicn_infra_plugin_enable_disable (
+ 1 /* enable */, node_ctl_params.pit_max_size,
+ node_ctl_params.pit_max_lifetime_sec, node_ctl_params.cs_max_size, ~0);
vlib_cli_output (vm, "hicn: fwdr initialize => %s\n",
get_error_string (ret));
- return (ret == HICN_ERROR_NONE) ? 0 : clib_error_return (0,
- get_error_string
- (ret));
+ return (ret == HICN_ERROR_NONE) ?
+ 0 :
+ clib_error_return (0, get_error_string (ret));
}
/*
* cli handler for 'control stop'
*/
static clib_error_t *
-hicn_cli_node_ctl_stop_set_command_fn (vlib_main_t * vm,
- unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_cli_node_ctl_stop_set_command_fn (vlib_main_t *vm,
+ unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
int ret;
@@ -99,32 +98,30 @@ hicn_cli_node_ctl_stop_set_command_fn (vlib_main_t * vm,
format_unformat_error, line_input);
}
}
- ret = hicn_infra_plugin_enable_disable (0 /* !enable */ ,
- node_ctl_params.pit_max_size,
- node_ctl_params.pit_max_lifetime_sec,
- node_ctl_params.cs_max_size, ~0);
+ ret = hicn_infra_plugin_enable_disable (
+ 0 /* !enable */, node_ctl_params.pit_max_size,
+ node_ctl_params.pit_max_lifetime_sec, node_ctl_params.cs_max_size, ~0);
- return (ret == HICN_ERROR_NONE) ? 0 : clib_error_return (0,
- get_error_string
- (ret));
+ return (ret == HICN_ERROR_NONE) ?
+ 0 :
+ clib_error_return (0, get_error_string (ret));
}
-#define DFLTD_RANGE_OK(val, min, max) \
-({ \
- __typeof__ (val) _val = (val); \
- __typeof__ (min) _min = (min); \
- __typeof__ (max) _max = (max); \
- (_val == -1) || \
- (_val >= _min && _val <= _max); \
-})
+#define DFLTD_RANGE_OK(val, min, max) \
+ ({ \
+ __typeof__ (val) _val = (val); \
+ __typeof__ (min) _min = (min); \
+ __typeof__ (max) _max = (max); \
+ (_val == -1) || (_val >= _min && _val <= _max); \
+ })
/*
* cli handler for 'control param'
*/
static clib_error_t *
-hicn_cli_node_ctl_param_set_command_fn (vlib_main_t * vm,
- unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_cli_node_ctl_param_set_command_fn (vlib_main_t *vm,
+ unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
int rv = 0;
@@ -133,16 +130,15 @@ hicn_cli_node_ctl_param_set_command_fn (vlib_main_t * vm,
if (hicn_main.is_enabled)
{
- return (clib_error_return
- (0, "params cannot be altered once hicn started"));
+ return (
+ clib_error_return (0, "params cannot be altered once hicn started"));
}
/* Get a line of input. */
unformat_input_t _line_input, *line_input = &_line_input;
if (!unformat_user (main_input, unformat_line_input, line_input))
{
- return clib_error_return (0,
- get_error_string
- (HICN_ERROR_FWD_ALREADY_ENABLED));
+ return clib_error_return (
+ 0, get_error_string (HICN_ERROR_FWD_ALREADY_ENABLED));
}
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
@@ -160,9 +156,9 @@ hicn_cli_node_ctl_param_set_command_fn (vlib_main_t * vm,
}
else if (unformat (line_input, "maxlife %f", &lifetime))
{
- if (!DFLTD_RANGE_OK
- (lifetime, HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC,
- HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC))
+ if (!DFLTD_RANGE_OK (lifetime,
+ HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC,
+ HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC))
{
rv = HICN_ERROR_PIT_CONFIG_MAXLT_OOB;
break;
@@ -201,25 +197,24 @@ hicn_cli_node_ctl_param_set_command_fn (vlib_main_t * vm,
}
if (node_ctl_params.cs_max_size == 0)
- vlib_cli_output (vm,
- "CS size set to 0. Consider disable CS at compilation time for better performances\n");
-
- return (rv == HICN_ERROR_NONE) ? 0 : clib_error_return (0, "%s '%U'",
- get_error_string
- (rv),
- format_unformat_error,
- line_input);
+ vlib_cli_output (vm, "CS size set to 0. Consider disable CS at "
+ "compilation time for better performances\n");
+
+ return (rv == HICN_ERROR_NONE) ?
+ 0 :
+ clib_error_return (0, "%s '%U'", get_error_string (rv),
+ format_unformat_error, line_input);
}
/*
* cli handler for 'hicn show'
*/
static clib_error_t *
-hicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_cli_show_command_fn (vlib_main_t *vm, unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
- int face_p = 0, fib_p = 0, all_p, internal_p = 0, strategies_p = 0, ret =
- HICN_ERROR_NONE;
+ int face_p = 0, fib_p = 0, all_p, internal_p = 0, strategies_p = 0,
+ ret = HICN_ERROR_NONE;
/* Get a line of input. */
unformat_input_t _line_input, *line_input = &_line_input;
@@ -294,8 +289,7 @@ hicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
" PIT:: max entries:%d,"
" lifetime default: max:%05.3f\n"
" CS:: max entries:%d\n",
- hicn_main.is_enabled ? "en" : "dis",
- hicn_infra_pit_size,
+ hicn_main.is_enabled ? "en" : "dis", hicn_infra_pit_size,
((f64) hicn_main.pit_lifetime_max_ms) / SEC_MS,
hicn_infra_cs_size);
@@ -303,25 +297,26 @@ hicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
, *rmp = &rm;
if (hicn_mgmt_node_stats_get (&rm) == HICN_ERROR_NONE)
{
- vlib_cli_output (vm, //compare vl_api_hicn_api_node_stats_get_reply_t_handler block
- " PIT entries (now): %d\n"
- " CS total entries (now): %d, network entries (now): %d\n"
- " Forwarding statistics:\n"
- " pkts_processed: %d\n"
- " pkts_interest_count: %d\n"
- " pkts_data_count: %d\n"
- " pkts_from_cache_count: %d\n"
- " interests_aggregated: %d\n"
- " interests_retransmitted: %d\n",
- clib_net_to_host_u64 (rmp->pit_entries_count),
- clib_net_to_host_u64 (rmp->cs_entries_count),
- clib_net_to_host_u64 (rmp->cs_entries_ntw_count),
- clib_net_to_host_u64 (rmp->pkts_processed),
- clib_net_to_host_u64 (rmp->pkts_interest_count),
- clib_net_to_host_u64 (rmp->pkts_data_count),
- clib_net_to_host_u64 (rmp->pkts_from_cache_count),
- clib_net_to_host_u64 (rmp->interests_aggregated),
- clib_net_to_host_u64 (rmp->interests_retx));
+ vlib_cli_output (
+ vm, // compare vl_api_hicn_api_node_stats_get_reply_t_handler block
+ " PIT entries (now): %d\n"
+ " CS total entries (now): %d, network entries (now): %d\n"
+ " Forwarding statistics:\n"
+ " pkts_processed: %d\n"
+ " pkts_interest_count: %d\n"
+ " pkts_data_count: %d\n"
+ " pkts_from_cache_count: %d\n"
+ " interests_aggregated: %d\n"
+ " interests_retransmitted: %d\n",
+ clib_net_to_host_u64 (rmp->pit_entries_count),
+ clib_net_to_host_u64 (rmp->cs_entries_count),
+ clib_net_to_host_u64 (rmp->cs_entries_ntw_count),
+ clib_net_to_host_u64 (rmp->pkts_processed),
+ clib_net_to_host_u64 (rmp->pkts_interest_count),
+ clib_net_to_host_u64 (rmp->pkts_data_count),
+ clib_net_to_host_u64 (rmp->pkts_from_cache_count),
+ clib_net_to_host_u64 (rmp->interests_aggregated),
+ clib_net_to_host_u64 (rmp->interests_retx));
}
if (face_p || all_p)
{
@@ -329,7 +324,6 @@ hicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
strbuf = format_hicn_face_all (strbuf, 1, 0);
vlib_cli_output (vm, "%s", strbuf);
-
}
if (strategies_p || all_p)
{
@@ -343,7 +337,8 @@ done:
{
vlib_cli_output (vm, "Plugin features: cs:%d\n", HICN_FEATURE_CS);
vlib_cli_output (vm,
- "Removed CS entries (and freed vlib buffers) %d, Removed PIT entries %d\n",
+ "Removed CS entries (and freed vlib buffers) %d, "
+ "Removed PIT entries %d\n",
hicn_main.pitcs.pcs_cs_dealloc,
hicn_main.pitcs.pcs_pit_dealloc);
vlib_cli_output (vm,
@@ -351,20 +346,19 @@ done:
hicn_main.pitcs.pcs_table->ht_bucket_count,
hicn_main.pitcs.pcs_table->ht_overflow_bucket_count,
hicn_main.pitcs.pcs_table->ht_overflow_buckets_used);
-
}
- return (ret == HICN_ERROR_NONE) ? 0 : clib_error_return (0, "%s\n",
- get_error_string
- (ret));
+ return (ret == HICN_ERROR_NONE) ?
+ 0 :
+ clib_error_return (0, "%s\n", get_error_string (ret));
}
/*
* cli handler for 'fib'
*/
static clib_error_t *
-hicn_cli_strategy_set_command_fn (vlib_main_t * vm,
- unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_cli_strategy_set_command_fn (vlib_main_t *vm,
+ unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
clib_error_t *cl_err = 0;
@@ -387,10 +381,11 @@ hicn_cli_strategy_set_command_fn (vlib_main_t * vm,
{
addpfx = 2;
}
- else if (addpfx != -1
- && unformat (line_input, "prefix %U/%d", unformat_ip46_address,
- &address, IP46_TYPE_ANY, &plen))
- {;
+ else if (addpfx != -1 &&
+ unformat (line_input, "prefix %U/%d", unformat_ip46_address,
+ &address, IP46_TYPE_ANY, &plen))
+ {
+ ;
}
else
{
@@ -412,10 +407,9 @@ hicn_cli_strategy_set_command_fn (vlib_main_t * vm,
}
rv = hicn_route_set_strategy (&prefix, strategy_id);
- cl_err =
- (rv == HICN_ERROR_NONE) ? NULL : clib_error_return (0,
- get_error_string
- (rv));
+ cl_err = (rv == HICN_ERROR_NONE) ?
+ NULL :
+ clib_error_return (0, get_error_string (rv));
done:
return (cl_err);
@@ -425,9 +419,9 @@ done:
* cli handler for 'pgen'
*/
static clib_error_t *
-hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
- unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_cli_pgen_client_set_command_fn (vlib_main_t *vm,
+ unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
hicnpg_main_t *hpgm = &hicnpg_main;
ip46_address_t src_addr;
@@ -446,14 +440,13 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
{
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat
- (line_input, "intfc %U", unformat_vnet_sw_interface, vnm,
- &sw_if_index))
+ if (unformat (line_input, "intfc %U", unformat_vnet_sw_interface,
+ vnm, &sw_if_index))
{
;
}
- else if (unformat (line_input, "src %U",
- unformat_ip46_address, &src_addr))
+ else if (unformat (line_input, "src %U", unformat_ip46_address,
+ &src_addr))
{
;
}
@@ -461,9 +454,8 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
{
;
}
- else if (unformat (line_input, "name %U/%d",
- unformat_ip46_address, &prefix->fp_addr,
- IP46_TYPE_ANY, &prefix->fp_len))
+ else if (unformat (line_input, "name %U/%d", unformat_ip46_address,
+ &prefix->fp_addr, IP46_TYPE_ANY, &prefix->fp_len))
{
;
}
@@ -481,9 +473,8 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
}
else
{
- return (clib_error_return
- (0, "Unknown input '%U'", format_unformat_error,
- line_input));
+ return (clib_error_return (0, "Unknown input '%U'",
+ format_unformat_error, line_input));
break;
}
}
@@ -495,7 +486,7 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
return (clib_error_return (0, "Packet generator interface missing"));
}
- //Remove bits that are out of the subnet
+ // Remove bits that are out of the subnet
if (ip46_address_is_ip4 (&prefix->fp_addr))
{
ip4_address_t mask;
@@ -517,34 +508,32 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
/*
* Enable the feature to divert data packet to the hicnpg-data node to count
* how many data packets have been received.
- * Diver all the packets from the packet-generator to the hicn-pg-interest node
- * to generate valid interests.
+ * Diver all the packets from the packet-generator to the hicn-pg-interest
+ * node to generate valid interests.
*/
- if (ip46_address_is_ip4 (&src_addr)
- && ip46_address_is_ip4 (&prefix->fp_addr))
+ if (ip46_address_is_ip4 (&src_addr) &&
+ ip46_address_is_ip4 (&prefix->fp_addr))
{
prefix->fp_proto = FIB_PROTOCOL_IP4;
- vnet_feature_enable_disable ("ip4-unicast", "hicnpg-data",
- sw_if_index, 1, 0, 0);
+ vnet_feature_enable_disable ("ip4-unicast", "hicnpg-data", sw_if_index,
+ 1, 0, 0);
/* Add pgen_client node to the vpp graph */
- vlib_node_add_next (vm,
- pg_input_node.index, hicn_pg_interest_node.index);
-
+ vlib_node_add_next (vm, pg_input_node.index,
+ hicn_pg_interest_node.index);
pg_node_t *pn;
pn = pg_get_node (hicn_pg_interest_node.index);
pn->unformat_edit = unformat_pg_ip4_header;
-
}
- else if (!ip46_address_is_ip4 (&src_addr)
- && !ip46_address_is_ip4 (&prefix->fp_addr))
+ else if (!ip46_address_is_ip4 (&src_addr) &&
+ !ip46_address_is_ip4 (&prefix->fp_addr))
{
prefix->fp_proto = FIB_PROTOCOL_IP6;
- vnet_feature_enable_disable ("ip6-unicast", "hicnpg-data",
- sw_if_index, 1, 0, 0);
+ vnet_feature_enable_disable ("ip6-unicast", "hicnpg-data", sw_if_index,
+ 1, 0, 0);
/* Add pgen_client node to the vpp graph */
vlib_node_add_next (vm, pg_input_node.index,
@@ -556,12 +545,11 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
}
else
{
- return (clib_error_return
- (0,
- "pg interface source address, source address and hicn name must be of the same type IPv4 or IPv6"));
+ return (clib_error_return (
+ 0, "pg interface source address, source address and hicn name must be "
+ "of the same type IPv4 or IPv6"));
}
-
hpgm->pgen_clt_src_addr = src_addr;
hpgm->pgen_clt_hicn_name = prefix;
hpgm->max_seq_number = max_seq;
@@ -591,9 +579,9 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
* cli handler for 'pgen'
*/
static clib_error_t *
-hicn_cli_pgen_server_set_command_fn (vlib_main_t * vm,
- unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_cli_pgen_server_set_command_fn (vlib_main_t *vm,
+ unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
clib_error_t *cl_err;
int rv = HICN_ERROR_NONE;
@@ -610,46 +598,43 @@ hicn_cli_pgen_server_set_command_fn (vlib_main_t * vm,
/* Parse the arguments */
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (line_input, "name %U/%d",
- unformat_ip46_address, &prefix->fp_addr,
- IP46_TYPE_ANY, &prefix->fp_len))
- {;
+ if (unformat (line_input, "name %U/%d", unformat_ip46_address,
+ &prefix->fp_addr, IP46_TYPE_ANY, &prefix->fp_len))
+ {
+ ;
}
else if (unformat (line_input, "size %d", &payload_size))
{
if (payload_size > 1440)
{
- return (clib_error_return (0,
- "Payload size must be <= 1440 bytes..."));
+ return (clib_error_return (
+ 0, "Payload size must be <= 1440 bytes..."));
}
}
- else
- if (unformat
- (line_input, "intfc %U", unformat_vnet_sw_interface, vnm,
- &sw_if_index))
+ else if (unformat (line_input, "intfc %U",
+ unformat_vnet_sw_interface, vnm, &sw_if_index))
{
;
}
else
{
- return (clib_error_return
- (0, "Unknown input '%U'", format_unformat_error,
- line_input));
+ return (clib_error_return (0, "Unknown input '%U'",
+ format_unformat_error, line_input));
break;
}
}
}
/* Attach our packet-gen node for ip4 udp local traffic */
- if ((prefix->fp_addr.ip6.as_u64[0] == (u64) 0
- && prefix->fp_addr.ip6.as_u64[1] == 0) || payload_size == 0
- || sw_if_index == ~0)
+ if ((prefix->fp_addr.ip6.as_u64[0] == (u64) 0 &&
+ prefix->fp_addr.ip6.as_u64[1] == 0) ||
+ payload_size == 0 || sw_if_index == ~0)
{
- return clib_error_return (0,
- "Error: must supply local port, payload size and incoming hICN prefix");
+ return clib_error_return (0, "Error: must supply local port, payload "
+ "size and incoming hICN prefix");
}
- //Remove bits that are out of the subnet
+ // Remove bits that are out of the subnet
if (ip46_address_is_ip4 (&prefix->fp_addr))
{
ip4_address_t mask;
@@ -685,10 +670,10 @@ hicn_cli_pgen_server_set_command_fn (vlib_main_t * vm,
memset (rb->data, 0, payload_size);
rb->current_length = payload_size;
- vnet_feature_enable_disable ("ip4-unicast", "hicnpg-server",
- sw_if_index, 1, 0, 0);
- vnet_feature_enable_disable ("ip6-unicast", "hicnpg-server",
- sw_if_index, 1, 0, 0);
+ vnet_feature_enable_disable ("ip4-unicast", "hicnpg-server", sw_if_index, 1,
+ 0, 0);
+ vnet_feature_enable_disable ("ip6-unicast", "hicnpg-server", sw_if_index, 1,
+ 0, 0);
switch (rv)
{
@@ -708,8 +693,8 @@ hicn_cli_pgen_server_set_command_fn (vlib_main_t * vm,
}
static clib_error_t *
-hicn_enable_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_enable_command_fn (vlib_main_t *vm, unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
clib_error_t *cl_err = 0;
@@ -724,13 +709,13 @@ hicn_enable_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
}
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (line_input, "%U/%d",
- unformat_ip4_address, &pfx.fp_addr.ip4, &pfx.fp_len))
+ if (unformat (line_input, "%U/%d", unformat_ip4_address,
+ &pfx.fp_addr.ip4, &pfx.fp_len))
{
pfx.fp_proto = FIB_PROTOCOL_IP4;
}
- else if (unformat (line_input, "%U/%d",
- unformat_ip6_address, &pfx.fp_addr.ip6, &pfx.fp_len))
+ else if (unformat (line_input, "%U/%d", unformat_ip6_address,
+ &pfx.fp_addr.ip6, &pfx.fp_len))
{
pfx.fp_proto = FIB_PROTOCOL_IP6;
}
@@ -745,16 +730,15 @@ hicn_enable_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
rv = hicn_route_enable (&pfx);
done:
- cl_err =
- (rv == HICN_ERROR_NONE) ? NULL : clib_error_return (0,
- get_error_string
- (rv));
+ cl_err = (rv == HICN_ERROR_NONE) ?
+ NULL :
+ clib_error_return (0, get_error_string (rv));
return cl_err;
}
static clib_error_t *
-hicn_disable_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_disable_command_fn (vlib_main_t *vm, unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
clib_error_t *cl_err = 0;
@@ -769,13 +753,13 @@ hicn_disable_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
}
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (line_input, "%U/%d",
- unformat_ip4_address, &pfx.fp_addr.ip4, &pfx.fp_len))
+ if (unformat (line_input, "%U/%d", unformat_ip4_address,
+ &pfx.fp_addr.ip4, &pfx.fp_len))
{
pfx.fp_proto = FIB_PROTOCOL_IP4;
}
- else if (unformat (line_input, "%U/%d",
- unformat_ip6_address, &pfx.fp_addr.ip6, &pfx.fp_len))
+ else if (unformat (line_input, "%U/%d", unformat_ip6_address,
+ &pfx.fp_addr.ip6, &pfx.fp_len))
{
pfx.fp_proto = FIB_PROTOCOL_IP6;
}
@@ -791,103 +775,91 @@ hicn_disable_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
rv = hicn_route_disable (&pfx);
done:
- cl_err =
- (rv == HICN_ERROR_NONE) ? NULL : clib_error_return (0,
- get_error_string
- (rv));
+ cl_err = (rv == HICN_ERROR_NONE) ?
+ NULL :
+ clib_error_return (0, get_error_string (rv));
return cl_err;
}
-
/* cli declaration for 'control start' */
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND(hicn_cli_node_ctl_start_set_command, static)=
-{
- .path = "hicn control start",
- .short_help = "hicn control start",
- .function = hicn_cli_node_ctl_start_set_command_fn,
+VLIB_CLI_COMMAND (hicn_cli_node_ctl_start_set_command, static) = {
+ .path = "hicn control start",
+ .short_help = "hicn control start",
+ .function = hicn_cli_node_ctl_start_set_command_fn,
};
-
/* cli declaration for 'control stop' */
-VLIB_CLI_COMMAND(hicn_cli_node_ctl_stop_set_command, static)=
-{
- .path = "hicn control stop",
- .short_help = "hicn control stop",
- .function = hicn_cli_node_ctl_stop_set_command_fn,
+VLIB_CLI_COMMAND (hicn_cli_node_ctl_stop_set_command, static) = {
+ .path = "hicn control stop",
+ .short_help = "hicn control stop",
+ .function = hicn_cli_node_ctl_stop_set_command_fn,
};
-
/* cli declaration for 'control param' */
-VLIB_CLI_COMMAND(hicn_cli_node_ctl_param_set_command, static)=
-{
- .path = "hicn control param",
- .short_help = "hicn control param { pit { size <entries> | { dfltlife | minlife | maxlife } <seconds> } | fib size <entries> | cs {size <entries> | app <portion to reserved to app>} }\n",
- .function = hicn_cli_node_ctl_param_set_command_fn,
+VLIB_CLI_COMMAND (hicn_cli_node_ctl_param_set_command, static) = {
+ .path = "hicn control param",
+ .short_help = "hicn control param { pit { size <entries> | { dfltlife | "
+ "minlife | maxlife } <seconds> } | fib size <entries> | cs "
+ "{size <entries> | app <portion to reserved to app>} }\n",
+ .function = hicn_cli_node_ctl_param_set_command_fn,
};
/* cli declaration for 'control' (root path of multiple commands, for help) */
-VLIB_CLI_COMMAND(hicn_cli_node_ctl_command, static)=
-{
- .path = "hicn control",
- .short_help = "hicn control"
-};
+VLIB_CLI_COMMAND (hicn_cli_node_ctl_command,
+ static) = { .path = "hicn control",
+ .short_help = "hicn control" };
/* cli declaration for 'fib' */
-VLIB_CLI_COMMAND(hicn_cli_strategy_set_command, static)=
- {
- .path = "hicn strategy",
- .short_help = "hicn strategy set <strategy_id> prefix <prefix>",
- .function = hicn_cli_strategy_set_command_fn,
- };
+VLIB_CLI_COMMAND (hicn_cli_strategy_set_command, static) = {
+ .path = "hicn strategy",
+ .short_help = "hicn strategy set <strategy_id> prefix <prefix>",
+ .function = hicn_cli_strategy_set_command_fn,
+};
/* cli declaration for 'show' */
-VLIB_CLI_COMMAND(hicn_cli_show_command, static)=
-{
- .path = "hicn show",
- .short_help = "hicn show "
- "[internal]"
- "[strategies]",
- .function = hicn_cli_show_command_fn,
+VLIB_CLI_COMMAND (hicn_cli_show_command, static) = {
+ .path = "hicn show",
+ .short_help = "hicn show "
+ "[internal]"
+ "[strategies]",
+ .function = hicn_cli_show_command_fn,
};
/* cli declaration for 'hicn pgen client' */
-VLIB_CLI_COMMAND(hicn_cli_pgen_client_set_command, static)=
-{
- .path = "hicn pgen client",
- .short_help = "hicn pgen client src <src_addr> name <prefix> { n_ifaces <n_ifaces> lifetime <interest-lifetime> intfc <data in-interface> max_seq <max sequence number> n_flows <number of flows>}",
- .long_help = "Run hicn in packet-gen client mode\n",
- .function = hicn_cli_pgen_client_set_command_fn,
+VLIB_CLI_COMMAND (hicn_cli_pgen_client_set_command, static) = {
+ .path = "hicn pgen client",
+ .short_help =
+ "hicn pgen client src <src_addr> name <prefix> { n_ifaces <n_ifaces> "
+ "lifetime <interest-lifetime> intfc <data in-interface> max_seq <max "
+ "sequence number> n_flows <number of flows>}",
+ .long_help = "Run hicn in packet-gen client mode\n",
+ .function = hicn_cli_pgen_client_set_command_fn,
};
/* cli declaration for 'hicn pgen client' */
-VLIB_CLI_COMMAND(hicn_cli_pgen_server_set_command, static)=
-{
- .path = "hicn pgen server",
- .short_help = "hicn pgen server name <prefix> intfc <interest in-interface> size <payload_size>",
- .long_help = "Run hicn in packet-gen server mode\n",
- .function = hicn_cli_pgen_server_set_command_fn,
+VLIB_CLI_COMMAND (hicn_cli_pgen_server_set_command, static) = {
+ .path = "hicn pgen server",
+ .short_help = "hicn pgen server name <prefix> intfc <interest in-interface> "
+ "size <payload_size>",
+ .long_help = "Run hicn in packet-gen server mode\n",
+ .function = hicn_cli_pgen_server_set_command_fn,
};
/* cli declaration for 'hicn pgen client' */
-VLIB_CLI_COMMAND(hicn_enable_command, static)=
- {
- .path = "hicn enable",
- .short_help = "hicn enable <prefix>",
- .long_help = "Enable hicn for the give prefix\n",
- .function = hicn_enable_command_fn,
- };
+VLIB_CLI_COMMAND (hicn_enable_command, static) = {
+ .path = "hicn enable",
+ .short_help = "hicn enable <prefix>",
+ .long_help = "Enable hicn for the give prefix\n",
+ .function = hicn_enable_command_fn,
+};
/* cli declaration for 'hicn pgen client' */
-VLIB_CLI_COMMAND(hicn_disable_command, static)=
- {
- .path = "hicn disable",
- .short_help = "hicn disable <prefix>",
- .long_help = "Disable hicn for the give prefix\n",
- .function = hicn_disable_command_fn,
- };
-
-/* *INDENT-ON* */
+VLIB_CLI_COMMAND (hicn_disable_command, static) = {
+ .path = "hicn disable",
+ .short_help = "hicn disable <prefix>",
+ .long_help = "Disable hicn for the give prefix\n",
+ .function = hicn_disable_command_fn,
+};
/*
* fd.io coding-style-patch-verification: ON