Fix dual-loop issue in vxlan_gpe decap 02/3602/3
authorHongjun Ni <hongjun.ni@intel.com>
Thu, 27 Oct 2016 10:39:44 +0000 (18:39 +0800)
committerChris Luke <chris_luke@comcast.com>
Mon, 7 Nov 2016 14:58:58 +0000 (14:58 +0000)
From logical point, if first packet is ipv4, and second packet is ipv6.
When first packet failed, the procedure will skip key6_1 setting.
This will lead to second packet's failure.
But here the graph node only process either ipv4 or ipv6 packets completely.
So it is not an issue here.

This patch only make the packet processig's logic clear. It is just a cosmetic change.

Change-Id: I0104ebf2546208d9068000649ce6dccdeeb5aa79
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
vnet/vnet/vxlan-gpe/decap.c

index 7eca3f6..f6d1402 100644 (file)
@@ -227,7 +227,31 @@ vxlan_gpe_input (vlib_main_t * vm,
 
         key4_0.pad = 0;
         key4_1.pad = 0;
+      }
+      else /* is_ip6 */
+      {
+        next0 = (iuvn6_0->vxlan.protocol < node->n_next_nodes) ?
+                iuvn6_0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
+        next1 = (iuvn6_1->vxlan.protocol < node->n_next_nodes) ?
+                iuvn6_1->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
+
+        key6_0.local.as_u64[0] = iuvn6_0->ip6.dst_address.as_u64[0];
+        key6_0.local.as_u64[1] = iuvn6_0->ip6.dst_address.as_u64[1];
+        key6_1.local.as_u64[0] = iuvn6_1->ip6.dst_address.as_u64[0];
+        key6_1.local.as_u64[1] = iuvn6_1->ip6.dst_address.as_u64[1];
+
+        key6_0.remote.as_u64[0] = iuvn6_0->ip6.src_address.as_u64[0];
+        key6_0.remote.as_u64[1] = iuvn6_0->ip6.src_address.as_u64[1];
+        key6_1.remote.as_u64[0] = iuvn6_1->ip6.src_address.as_u64[0];
+        key6_1.remote.as_u64[1] = iuvn6_1->ip6.src_address.as_u64[1];
+
+        key6_0.vni = iuvn6_0->vxlan.vni_res;
+        key6_1.vni = iuvn6_1->vxlan.vni_res;
+      }
 
+      /* Processing packet 0*/
+      if (is_ip4)
+      {
         /* Processing for key4_0 */
         if (PREDICT_FALSE((key4_0.as_u64[0] != last_key4.as_u64[0])
                 || (key4_0.as_u64[1] != last_key4.as_u64[1])))
@@ -249,24 +273,6 @@ vxlan_gpe_input (vlib_main_t * vm,
       }
       else /* is_ip6 */
       {
-        next0 = (iuvn6_0->vxlan.protocol < node->n_next_nodes) ?
-                iuvn6_0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
-        next1 = (iuvn6_1->vxlan.protocol < node->n_next_nodes) ?
-                iuvn6_1->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
-
-        key6_0.local.as_u64[0] = iuvn6_0->ip6.dst_address.as_u64[0];
-        key6_0.local.as_u64[1] = iuvn6_0->ip6.dst_address.as_u64[1];
-        key6_1.local.as_u64[0] = iuvn6_1->ip6.dst_address.as_u64[0];
-        key6_1.local.as_u64[1] = iuvn6_1->ip6.dst_address.as_u64[1];
-
-        key6_0.remote.as_u64[0] = iuvn6_0->ip6.src_address.as_u64[0];
-        key6_0.remote.as_u64[1] = iuvn6_0->ip6.src_address.as_u64[1];
-        key6_1.remote.as_u64[0] = iuvn6_1->ip6.src_address.as_u64[0];
-        key6_1.remote.as_u64[1] = iuvn6_1->ip6.src_address.as_u64[1];
-
-        key6_0.vni = iuvn6_0->vxlan.vni_res;
-        key6_1.vni = iuvn6_1->vxlan.vni_res;
-
         /* Processing for key6_0 */
         if (PREDICT_FALSE(memcmp (&key6_0, &last_key6, sizeof(last_key6)) != 0))
         {