IF: return VTR attributes for all ifs in dump API 96/19196/1
authorAlexander Chernavin <achernavin@netgate.com>
Fri, 26 Apr 2019 14:43:09 +0000 (10:43 -0400)
committerAlexander Chernavin <achernavin@netgate.com>
Fri, 26 Apr 2019 14:43:09 +0000 (10:43 -0400)
With this commit, VTR attributes are shown not only for subinterfaces
but for all interfaces.

Change-Id: I498185d905c0bf48431cddb916165f8e9c841b1f
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
src/vnet/interface_api.c

index 4cd2ec9..b896433 100644 (file)
@@ -239,38 +239,38 @@ send_sw_interface_details (vpe_api_main_t * am,
       mp->sub_default = sub->eth.flags.default_sub;
       mp->sub_outer_vlan_id_any = sub->eth.flags.outer_vlan_id_any;
       mp->sub_inner_vlan_id_any = sub->eth.flags.inner_vlan_id_any;
+    }
 
-      /* vlan tag rewrite data */
-      u32 vtr_op = L2_VTR_DISABLED;
-      u32 vtr_push_dot1q = 0, vtr_tag1 = 0, vtr_tag2 = 0;
+  /* vlan tag rewrite data */
+  u32 vtr_op = L2_VTR_DISABLED;
+  u32 vtr_push_dot1q = 0, vtr_tag1 = 0, vtr_tag2 = 0;
 
-      if (l2vtr_get (am->vlib_main, am->vnet_main, swif->sw_if_index,
-                    &vtr_op, &vtr_push_dot1q, &vtr_tag1, &vtr_tag2) != 0)
-       {
-         // error - default to disabled
-         mp->vtr_op = ntohl (L2_VTR_DISABLED);
-         clib_warning ("cannot get vlan tag rewrite for sw_if_index %d",
-                       swif->sw_if_index);
-       }
-      else
-       {
-         mp->vtr_op = ntohl (vtr_op);
-         mp->vtr_push_dot1q = ntohl (vtr_push_dot1q);
-         mp->vtr_tag1 = ntohl (vtr_tag1);
-         mp->vtr_tag2 = ntohl (vtr_tag2);
-       }
+  if (l2vtr_get (am->vlib_main, am->vnet_main, swif->sw_if_index,
+                &vtr_op, &vtr_push_dot1q, &vtr_tag1, &vtr_tag2) != 0)
+    {
+      // error - default to disabled
+      mp->vtr_op = ntohl (L2_VTR_DISABLED);
+      clib_warning ("cannot get vlan tag rewrite for sw_if_index %d",
+                   swif->sw_if_index);
+    }
+  else
+    {
+      mp->vtr_op = ntohl (vtr_op);
+      mp->vtr_push_dot1q = ntohl (vtr_push_dot1q);
+      mp->vtr_tag1 = ntohl (vtr_tag1);
+      mp->vtr_tag2 = ntohl (vtr_tag2);
     }
 
   /* pbb tag rewrite data */
   ethernet_header_t eth_hdr;
-  u32 vtr_op = L2_VTR_DISABLED;
+  u32 pbb_vtr_op = L2_VTR_DISABLED;
   u16 outer_tag = 0;
   u16 b_vlanid = 0;
   u32 i_sid = 0;
   clib_memset (&eth_hdr, 0, sizeof (eth_hdr));
 
   if (!l2pbb_get (am->vlib_main, am->vnet_main, swif->sw_if_index,
-                 &vtr_op, &outer_tag, &eth_hdr, &b_vlanid, &i_sid))
+                 &pbb_vtr_op, &outer_tag, &eth_hdr, &b_vlanid, &i_sid))
     {
       mp->sub_dot1ah = 1;
       clib_memcpy (mp->b_dmac, eth_hdr.dst_address,