From 6a0b7e3970f3f4c729112a809665cc2b6a074037 Mon Sep 17 00:00:00 2001 From: Vengada Date: Fri, 27 Jan 2017 01:57:46 -0800 Subject: Cleanup some obfuscated code in next node handling. The values of next node can be simply assigned by dereferencing the pointer instead of obfuscating the dereference. Change-Id: I1f4a3d51b768960699010591410695473728d3a2 Signed-off-by: Vengada --- src/plugins/ioam/lib-vxlan-gpe/ioam_decap.c | 6 +++--- src/plugins/ioam/lib-vxlan-gpe/ioam_encap.c | 2 +- src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/plugins/ioam/lib-vxlan-gpe') diff --git a/src/plugins/ioam/lib-vxlan-gpe/ioam_decap.c b/src/plugins/ioam/lib-vxlan-gpe/ioam_decap.c index a0a76a8dce1..87e57d3605e 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/ioam_decap.c +++ b/src/plugins/ioam/lib-vxlan-gpe/ioam_decap.c @@ -51,11 +51,11 @@ vxlan_gpe_decap_ioam_v4_two_inline (vlib_main_t * vm, { vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main; - next0[0] = next1[0] = hm->decap_v4_next_override; - vxlan_gpe_encap_decap_ioam_v4_one_inline (vm, node, b0, &next0[0], + *next0 = *next1 = hm->decap_v4_next_override; + vxlan_gpe_encap_decap_ioam_v4_one_inline (vm, node, b0, next0, VXLAN_GPE_DECAP_IOAM_V4_NEXT_DROP, 0 /* use_adj */ ); - vxlan_gpe_encap_decap_ioam_v4_one_inline (vm, node, b1, &next1[0], + vxlan_gpe_encap_decap_ioam_v4_one_inline (vm, node, b1, next1, VXLAN_GPE_DECAP_IOAM_V4_NEXT_DROP, 0 /* use_adj */ ); } diff --git a/src/plugins/ioam/lib-vxlan-gpe/ioam_encap.c b/src/plugins/ioam/lib-vxlan-gpe/ioam_encap.c index 4b18bfea533..1d15654464d 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/ioam_encap.c +++ b/src/plugins/ioam/lib-vxlan-gpe/ioam_encap.c @@ -55,7 +55,7 @@ vxlan_gpe_encap_ioam_v4_two_inline (vlib_main_t * vm, vlib_buffer_t * b0, vlib_buffer_t * b1, u32 * next0, u32 * next1) { - next0[0] = next1[0] = VXLAN_GPE_ENCAP_IOAM_V4_NEXT_IP4_LOOKUP; + *next0 = *next1 = VXLAN_GPE_ENCAP_IOAM_V4_NEXT_IP4_LOOKUP; vxlan_gpe_encap_decap_ioam_v4_one_inline (vm, node, b0, next0, VXLAN_GPE_ENCAP_IOAM_V4_NEXT_DROP, 0 /* use_adj */ ); diff --git a/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c b/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c index 55c33b144a1..7a4580d804f 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c +++ b/src/plugins/ioam/lib-vxlan-gpe/ioam_pop.c @@ -151,7 +151,7 @@ vxlan_gpe_pop_ioam_v4_one_inline (vlib_main_t * vm, */ if (gpe_ioam0->length > clib_net_to_host_u16 (ip0->length)) { - next0[0] = VXLAN_GPE_INPUT_NEXT_DROP; + *next0 = VXLAN_GPE_INPUT_NEXT_DROP; goto trace00; } @@ -172,7 +172,7 @@ vxlan_gpe_pop_ioam_v4_one_inline (vlib_main_t * vm, { if ((*hm->pop_options[type0]) (ip0, opt0) < 0) { - next0[0] = VXLAN_GPE_INPUT_NEXT_DROP; + *next0 = VXLAN_GPE_INPUT_NEXT_DROP; goto trace00; } } @@ -184,7 +184,7 @@ vxlan_gpe_pop_ioam_v4_one_inline (vlib_main_t * vm, } - next0[0] = + *next0 = (gpe_ioam0->protocol < VXLAN_GPE_PROTOCOL_MAX) ? ngm-> decap_next_node_list[gpe_ioam0->protocol] : VXLAN_GPE_INPUT_NEXT_DROP; @@ -195,7 +195,7 @@ trace00: vxlan_gpe_pop_ioam_v4_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); u32 trace_len = gpe_ioam0->length; - t->fmt_trace.next_index = next0[0]; + t->fmt_trace.next_index = *next0; /* Capture the h-b-h option verbatim */ trace_len = trace_len < -- cgit 1.2.3-korg