diff options
author | Peter Lei <peterlei@cisco.com> | 2016-04-08 08:16:31 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-04-11 11:38:28 +0000 |
commit | dba76f29e6ab51b0f3fd01ca2928652186392132 (patch) | |
tree | d5bfeac0a6c692dc8fbce3fdac1fd377754748dc /vnet/vnet/devices/af_packet/cli.c | |
parent | d5304450671790f085f897c7792cff4010085d06 (diff) |
Add option to delete af_packet (host) interfaces
Change-Id: Iab76951758ae9b9a99d679a223941a4b8c683078
Signed-off-by: Alpesh S. Patel <apatel9191@hotmail.com>
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet/vnet/devices/af_packet/cli.c')
-rw-r--r-- | vnet/vnet/devices/af_packet/cli.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vnet/vnet/devices/af_packet/cli.c b/vnet/vnet/devices/af_packet/cli.c index d8d829f63ad..4ac51cb06a9 100644 --- a/vnet/vnet/devices/af_packet/cli.c +++ b/vnet/vnet/devices/af_packet/cli.c @@ -80,6 +80,40 @@ VLIB_CLI_COMMAND (af_packet_create_command, static) = { .function = af_packet_create_command_fn, }; +static clib_error_t * +af_packet_delete_command_fn (vlib_main_t * vm, unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + unformat_input_t _line_input, * line_input = &_line_input; + u8 * host_if_name = NULL; + + /* Get a line of input. */ + if (! unformat_user (input, unformat_line_input, line_input)) + return 0; + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "name %s", &host_if_name)) + ; + else + return clib_error_return (0, "unknown input `%U'", format_unformat_error, input); + } + unformat_free (line_input); + + if (host_if_name == NULL) + return clib_error_return (0, "missing host interface name"); + + af_packet_delete_if(vm, host_if_name); + + return 0; +} + +VLIB_CLI_COMMAND (af_packet_delete_command, static) = { + .path = "delete host-interface", + .short_help = "delete host-interface name <interface name>", + .function = af_packet_delete_command_fn, +}; + clib_error_t * af_packet_cli_init (vlib_main_t * vm) { |