aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/tap/tap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/devices/tap/tap.c')
-rw-r--r--src/vnet/devices/tap/tap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index eb5a7a9eb2e..8005b347391 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -130,8 +130,6 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
vif->tap_fd = -1;
vif->id = args->id;
- hash_set (tm->dev_instance_by_interface_id, vif->id, vif->dev_instance);
-
if ((vif->fd = open ("/dev/vhost-net", O_RDWR | O_NONBLOCK)) < 0)
{
args->rv = VNET_API_ERROR_SYSCALL_ERROR_1;
@@ -383,6 +381,8 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
goto error;
}
+ hash_set (tm->dev_instance_by_interface_id, vif->id, vif->dev_instance);
+
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;