Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
tap: set device name on creation via TUNSETIFF
[vpp.git]
/
src
/
vnet
/
devices
/
tap
/
tap.c
diff --git
a/src/vnet/devices/tap/tap.c
b/src/vnet/devices/tap/tap.c
index
33d6e3b
..
8fca35d
100644
(file)
--- 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->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");
{
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;
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;
}
}
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)
}
if (vif->type == VIRTIO_IF_TYPE_TAP)