tap: fix dump for TUN interfaces 36/27736/2
authorMohsin Kazmi <sykazmi@cisco.com>
Tue, 30 Jun 2020 13:28:01 +0000 (15:28 +0200)
committerBenoît Ganne <bganne@cisco.com>
Thu, 2 Jul 2020 14:48:14 +0000 (14:48 +0000)
Type: fix

Change-Id: I3bcc8ff1cf0a828ce3ba112694d38e3287d38d8d
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
src/vnet/devices/tap/tap.c
src/vnet/devices/virtio/virtio.h

index 1ba74d5..cbdbbe9 100644 (file)
@@ -671,6 +671,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
   vif->host_if_name = format (0, "%s%c", host_if_name, 0);
   vif->net_ns = format (0, "%s%c", args->host_namespace, 0);
   vif->host_mtu_size = args->host_mtu_size;
+  vif->tap_flags = args->tap_flags;
   clib_memcpy (vif->host_mac_addr, args->host_mac_addr.bytes, 6);
   vif->host_ip4_prefix_len = args->host_ip4_prefix_len;
   vif->host_ip6_prefix_len = args->host_ip6_prefix_len;
@@ -912,7 +913,8 @@ tap_dump_ifs (tap_interface_details_t ** out_tapids)
 
   /* *INDENT-OFF* */
   pool_foreach (vif, mm->interfaces,
-    if (vif->type != VIRTIO_IF_TYPE_TAP)
+    if ((vif->type != VIRTIO_IF_TYPE_TAP)
+      && (vif->type != VIRTIO_IF_TYPE_TUN))
       continue;
     vec_add2(r_tapids, tapid, 1);
     clib_memset (tapid, 0, sizeof (*tapid));
@@ -926,6 +928,7 @@ tap_dump_ifs (tap_interface_details_t ** out_tapids)
     tapid->rx_ring_sz = vring->size;
     vring = vec_elt_at_index (vif->txq_vrings, TX_QUEUE_ACCESS(0));
     tapid->tx_ring_sz = vring->size;
+    tapid->tap_flags = vif->tap_flags;
     clib_memcpy(&tapid->host_mac_addr, vif->host_mac_addr, 6);
     if (vif->host_if_name)
       {
index 68462d8..0520354 100644 (file)
@@ -190,6 +190,7 @@ typedef struct
   ip6_address_t host_ip6_addr;
   u8 host_ip6_prefix_len;
   u32 host_mtu_size;
+  u32 tap_flags;
   int ifindex;
   virtio_vring_t *cxq_vring;
 } virtio_if_t;