aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2023-02-14 15:39:20 +0100
committerMauro Sardara <msardara@cisco.com>2023-02-14 16:42:03 +0100
commitebb918df1c31898ce0f61e4443de5e1cbf0c4325 (patch)
tree6fa51048e1a186274c247408768499f0e3eb1cc1
parentda80325f47a9c58aa493441ab54116019811072f (diff)
fix(hicn-plugin): error on possible uninitialized variablestable/2210
Change-Id: I7a3b7176bd7599888237f631b7352b56e8e1e5e4 (cherry picked from commit 72b817788da71336fda8f75a81db59dc2fe98bb6) Signed-off-by: Mauro Sardara <msardara@cisco.com>
-rw-r--r--hicn-plugin/src/mapme_ctrl_node.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/hicn-plugin/src/mapme_ctrl_node.c b/hicn-plugin/src/mapme_ctrl_node.c
index 5d4fc5c12..cf825a957 100644
--- a/hicn-plugin/src/mapme_ctrl_node.c
+++ b/hicn-plugin/src/mapme_ctrl_node.c
@@ -487,10 +487,10 @@ hicn_mapme_ctrl_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
hicn_mapme_ctrl_next_t next_index;
u32 n_left_from, *from, *to_next;
n_left_from = frame->n_vectors;
- // hicn_face_id_t in_face;
hicn_prefix_t prefix;
u32 seq;
- hicn_mapme_type_t type;
+ hicn_mapme_type_t type = UPDATE;
+ int ret;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -520,9 +520,19 @@ hicn_mapme_ctrl_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
*/
u32 next0 = HICN_MAPME_CTRL_NEXT_IP6_OUTPUT;
- hicn_mapme_process_ctrl (vm, b0, hb->face_id, &prefix, &seq, &type);
+ ret = hicn_mapme_process_ctrl (vm, b0, hb->face_id, &prefix, &seq,
+ &type);
- vnet_buffer (b0)->ip.adj_index[VLIB_TX] = hb->face_id;
+ if (PREDICT_FALSE (ret == 0))
+ {
+ next0 = HICN_MAPME_CTRL_NEXT_ERROR_DROP;
+ seq = ~0;
+ type = UNKNOWN;
+ }
+ else
+ {
+ vnet_buffer (b0)->ip.adj_index[VLIB_TX] = hb->face_id;
+ }
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
(b0->flags & VLIB_BUFFER_IS_TRACED)))
@@ -540,9 +550,7 @@ hicn_mapme_ctrl_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- // vlib_node_increment_counter (vm, hicn_mapme_ctrl_node.index,
- // HICN_MAPME_CTRL_ERROR_SWAPPED,
- // pkts_swapped);
+
return frame->n_vectors;
}