summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2017-05-19 23:52:34 +0800
committerHongjun Ni <hongjun.ni@intel.com>2017-05-22 01:38:45 +0000
commite60959a2ad5b36e913c2ca92bcd52325ed9ecc89 (patch)
treec957f5298efb4280869921ac3682324c3189929a
parent01384fe3d4c8f9d5c082cd602087a8eb71facd15 (diff)
Fix GTP-U Coverity issues
Change-Id: I982e0dfb96c371672aa636aa7e40f06a84e2bb69 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
-rw-r--r--src/plugins/gtpu/gtpu_encap.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/src/plugins/gtpu/gtpu_encap.c b/src/plugins/gtpu/gtpu_encap.c
index a2cfc64633b..ef109c66ac8 100644
--- a/src/plugins/gtpu/gtpu_encap.c
+++ b/src/plugins/gtpu/gtpu_encap.c
@@ -145,25 +145,19 @@ gtpu_encap_inline (vlib_main_t * vm,
flow_hash1 = vnet_l2_compute_flow_hash (b1);
/* Get next node index and adj index from tunnel next_dpo */
- if (sw_if_index0 != vnet_buffer(b0)->sw_if_index[VLIB_TX])
- {
- sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
- hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
- t0 = &gtm->tunnels[hi0->dev_instance];
- /* Note: change to always set next0 if it may be set to drop */
- next0 = t0->next_dpo.dpoi_next_node;
- }
+ sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
+ hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
+ t0 = &gtm->tunnels[hi0->dev_instance];
+ /* Note: change to always set next0 if it may be set to drop */
+ next0 = t0->next_dpo.dpoi_next_node;
vnet_buffer(b0)->ip.adj_index[VLIB_TX] = t0->next_dpo.dpoi_index;
/* Get next node index and adj index from tunnel next_dpo */
- if (sw_if_index1 != vnet_buffer(b1)->sw_if_index[VLIB_TX])
- {
- sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_TX];
- hi1 = vnet_get_sup_hw_interface (vnm, sw_if_index1);
- t1 = &gtm->tunnels[hi1->dev_instance];
- /* Note: change to always set next1 if it may be set to drop */
- next1 = t1->next_dpo.dpoi_next_node;
- }
+ sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_TX];
+ hi1 = vnet_get_sup_hw_interface (vnm, sw_if_index1);
+ t1 = &gtm->tunnels[hi1->dev_instance];
+ /* Note: change to always set next1 if it may be set to drop */
+ next1 = t1->next_dpo.dpoi_next_node;
vnet_buffer(b1)->ip.adj_index[VLIB_TX] = t1->next_dpo.dpoi_index;
/* Apply the rewrite string. $$$$ vnet_rewrite? */
@@ -376,14 +370,11 @@ gtpu_encap_inline (vlib_main_t * vm,
flow_hash0 = vnet_l2_compute_flow_hash(b0);
/* Get next node index and adj index from tunnel next_dpo */
- if (sw_if_index0 != vnet_buffer(b0)->sw_if_index[VLIB_TX])
- {
- sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
- hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
- t0 = &gtm->tunnels[hi0->dev_instance];
- /* Note: change to always set next0 if it may be set to drop */
- next0 = t0->next_dpo.dpoi_next_node;
- }
+ sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
+ hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
+ t0 = &gtm->tunnels[hi0->dev_instance];
+ /* Note: change to always set next0 if it may be set to drop */
+ next0 = t0->next_dpo.dpoi_next_node;
vnet_buffer(b0)->ip.adj_index[VLIB_TX] = t0->next_dpo.dpoi_index;
/* Apply the rewrite string. $$$$ vnet_rewrite? */