diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2020-01-30 16:08:08 +0100 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2020-03-27 14:29:18 +0000 |
commit | fd8da464989cf9b166848dd9f0bacbcbae156121 (patch) | |
tree | dbcab0fc4cd0af99d2d723634505be70362b255e /src/vnet/devices/tap | |
parent | a8e2c583e2cc7610a43c1b0e07c928519b7d619c (diff) |
tap: fix host mtu configuration setting
host mtu can't be set if tap interface is in namespace.
This patch fixes this issue.
Type: fix
Change-Id: I63811c4b56c708fe708061a8afbaec41994f08ca
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
(cherry picked from commit 91592c0c9cdd1bc61a2796e41a8becc30aaf8082)
Diffstat (limited to 'src/vnet/devices/tap')
-rw-r--r-- | src/vnet/devices/tap/tap.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 63716a91e2c..3e36b6c3e74 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -423,18 +423,6 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) } } - /* switch back to old net namespace */ - if (args->host_namespace) - { - if (setns (old_netns_fd, CLONE_NEWNET) == -1) - { - args->rv = VNET_API_ERROR_SYSCALL_ERROR_2; - args->error = clib_error_return_unix (0, "setns '%s'", - args->host_namespace); - goto error; - } - } - if (args->host_mtu_set) { args->error = @@ -458,6 +446,18 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) args->host_mtu_size = tm->host_mtu_size; } + /* switch back to old net namespace */ + if (args->host_namespace) + { + if (setns (old_netns_fd, CLONE_NEWNET) == -1) + { + args->rv = VNET_API_ERROR_SYSCALL_ERROR_2; + args->error = clib_error_return_unix (0, "setns '%s'", + args->host_namespace); + goto error; + } + } + for (i = 0; i < num_q_pairs; i++) { if (i < vif->num_rxqs && (args->error = @@ -633,6 +633,7 @@ error: args->rv = VNET_API_ERROR_SYSCALL_ERROR_3; } + tap_log_err (vif, "%U", format_clib_error, args->error); tap_free (vm, vif); done: if (vhost_mem) |