From c5d5327ac59a212ecbdbbcf57e648becd02a702d Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Mon, 1 Jul 2019 10:26:43 +0200 Subject: [PATCH] tap: print the interface name on cli when created Type: feature Change-Id: If11f00574322c35c1780c31d5f7b47d30e083e35 Signed-off-by: Mohsin Kazmi --- src/vnet/devices/tap/cli.c | 5 +++++ src/vnet/devices/tap/tap.c | 1 + 2 files changed, 6 insertions(+) diff --git a/src/vnet/devices/tap/cli.c b/src/vnet/devices/tap/cli.c index c74d24a12a9..5bf38a38659 100644 --- a/src/vnet/devices/tap/cli.c +++ b/src/vnet/devices/tap/cli.c @@ -40,6 +40,7 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input, args.id = ~0; args.tap_flags = 0; + args.rv = -1; /* Get a line of input. */ if (unformat_user (input, unformat_line_input, line_input)) @@ -103,6 +104,10 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input, tap_create_if (vm, &args); + if (!args.rv) + vlib_cli_output (vm, "%U\n", format_vnet_sw_if_index_name, + vnet_get_main (), args.sw_if_index); + vec_free (args.host_if_name); vec_free (args.host_namespace); vec_free (args.host_bridge); diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 974a4175fa6..6c6d2cac7cb 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -441,6 +441,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) sw = vnet_get_hw_sw_interface (vnm, vif->hw_if_index); vif->sw_if_index = sw->sw_if_index; args->sw_if_index = vif->sw_if_index; + args->rv = 0; hw = vnet_get_hw_interface (vnm, vif->hw_if_index); hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE; if (args->tap_flags & TAP_FLAG_GSO) -- 2.16.6