X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fdevices%2Ftap%2Ftap.c;fp=src%2Fvnet%2Fdevices%2Ftap%2Ftap.c;h=8fca35df2025ddf29d75bd2ecb0b22f8e2f0ead1;hb=764a8780c2ad250b76f289d742d22216d8c0904e;hp=33d6e3bc84a0d06012b73735d58863913d81ed18;hpb=c26cc72edf195a3f57c734b5161bd37995002107;p=vpp.git diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 33d6e3bc84a..8fca35df202 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -195,13 +195,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) if (args->tap_flags & TAP_FLAG_ATTACH) { - if (args->host_if_name != NULL) - { - host_if_name = (char *) args->host_if_name; - clib_memcpy (ifr.ifr_name, host_if_name, - clib_min (IFNAMSIZ, vec_len (host_if_name))); - } - else + if (args->host_if_name == NULL) { args->rv = VNET_API_ERROR_NO_MATCHING_INTERFACE; err = clib_error_return (0, "host_if_name is not provided"); @@ -227,6 +221,13 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) } } + if (args->host_if_name != NULL) + { + host_if_name = (char *) args->host_if_name; + clib_memcpy (ifr.ifr_name, host_if_name, + clib_min (IFNAMSIZ, vec_len (host_if_name))); + } + if ((tfd = open ("/dev/net/tun", O_RDWR | O_NONBLOCK)) < 0) { args->rv = VNET_API_ERROR_SYSCALL_ERROR_2; @@ -435,16 +436,6 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) goto error; } } - else if (host_if_name) - { - args->error = - vnet_netlink_set_link_name (vif->ifindex, host_if_name); - if (args->error) - { - args->rv = VNET_API_ERROR_NETLINK_ERROR; - goto error; - } - } } if (vif->type == VIRTIO_IF_TYPE_TAP)