diff options
Diffstat (limited to 'src/vnet/devices/tap')
-rw-r--r-- | src/vnet/devices/tap/tapv2.api | 2 | ||||
-rw-r--r-- | src/vnet/devices/tap/tapv2_api.c | 21 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/vnet/devices/tap/tapv2.api b/src/vnet/devices/tap/tapv2.api index dee73043c0f..c11a07cf72a 100644 --- a/src/vnet/devices/tap/tapv2.api +++ b/src/vnet/devices/tap/tapv2.api @@ -55,7 +55,7 @@ define tap_create_v2 { u32 client_index; u32 context; - u32 id; + u32 id [default= 0xffffffff] ; u8 use_random_mac; u8 mac_address[6]; u16 tx_ring_sz; /* optional, default is 256 entries, must be power of 2 */ diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c index 2471d0084e1..a1acacf4719 100644 --- a/src/vnet/devices/tap/tapv2_api.c +++ b/src/vnet/devices/tap/tapv2_api.c @@ -52,10 +52,15 @@ _(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump) static void vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp) { + vl_api_registration_t *reg; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; + vnet_main_t *vnm = vnet_get_main (); vlib_main_t *vm = vlib_get_main (); vl_api_tap_create_v2_reply_t *rmp; - vl_api_registration_t *reg; + tap_create_if_args_t _a, *ap = &_a; clib_memset (ap, 0, sizeof (*ap)); @@ -119,9 +124,6 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp) tap_create_if (vm, ap); - reg = vl_api_client_index_to_registration (mp->client_index); - if (!reg) - return;; /* If a tag was supplied... */ if (mp->tag[0]) @@ -145,18 +147,21 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp) static void vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp) { + vl_api_registration_t *reg; + reg = vl_api_client_index_to_registration (mp->client_index); + if (!reg) + return; + vnet_main_t *vnm = vnet_get_main (); vlib_main_t *vm = vlib_get_main (); int rv; vl_api_tap_delete_v2_reply_t *rmp; - vl_api_registration_t *reg; + u32 sw_if_index = ntohl (mp->sw_if_index); rv = tap_delete_if (vm, sw_if_index); - reg = vl_api_client_index_to_registration (mp->client_index); - if (!reg) - return; + rmp = vl_msg_api_alloc (sizeof (*rmp)); rmp->_vl_msg_id = ntohs (VL_API_TAP_DELETE_V2_REPLY); |