tap: fix the crash 82/18882/2
authorMohsin Kazmi <sykazmi@cisco.com>
Mon, 15 Apr 2019 11:17:55 +0000 (13:17 +0200)
committerDave Barach <openvpp@barachs.net>
Mon, 15 Apr 2019 12:56:11 +0000 (12:56 +0000)
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>
src/vnet/devices/tap/tap.c

index 388cfa3..91d4a81 100644 (file)
@@ -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)