summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2019-04-15 13:17:55 +0200
committerDamjan Marion <dmarion@me.com>2019-04-16 15:53:49 +0000
commit6c2f821179ea8d8c848b33e180936c20479b57fc (patch)
tree90d3d3cbca1bf2b2b6704b1b6b32bb05a75205b6
parent58dcf5c5e6728250a61e9a498972d896308d9624 (diff)
tap: fix the crash [VPP-1645]
Crash will happen when someone will try to setup a tap interface in host namespace without providing the host side of tap interface custom name. This patch fixes the problem by using the default name in this case. Change-Id: Ic1eaea5abd01bc6c766d0e0fcacae29ab7a7ec45 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 2a6861ff7bc90c1518b68459210830052774d429)
-rw-r--r--src/vnet/devices/tap/tap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 388cfa34c37..91d4a811ad8 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -175,6 +175,9 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
_IOCTL (vif->tap_fd, TUNSETIFF, (void *) &ifr);
vif->ifindex = if_nametoindex (ifr.ifr_ifrn.ifrn_name);
+ if (!args->host_if_name)
+ args->host_if_name = (u8 *) ifr.ifr_ifrn.ifrn_name;
+
unsigned int offload = 0;
hdrsz = sizeof (struct virtio_net_hdr_v1);
if (args->tap_flags & TAP_FLAG_GSO)