From e74c1dc577edf19d485e8a37977b06f502cc76bd Mon Sep 17 00:00:00 2001 From: Hongjun Ni Date: Thu, 27 Oct 2016 18:39:44 +0800 Subject: [PATCH] Fix dual-loop issue in vxlan_gpe decap 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 --- vnet/vnet/vxlan-gpe/decap.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/vnet/vnet/vxlan-gpe/decap.c b/vnet/vnet/vxlan-gpe/decap.c index 7eca3f6b8dc..f6d1402d3f0 100644 --- a/vnet/vnet/vxlan-gpe/decap.c +++ b/vnet/vnet/vxlan-gpe/decap.c @@ -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)) { -- 2.16.6