aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Sliwa <szs@semihalf.com>2018-02-14 15:57:48 +0100
committerSzymon Sliwa <szs@semihalf.com>2018-02-19 17:47:48 +0100
commit808c3e6e7b1c764bd77b12d4bc5ffc68707971a9 (patch)
treebfff91d9efaa39b0ddc4b5c3d165aef26160edd9
parent34c3e2b4a949cba8ebe54af9cacb32419a3717da (diff)
plugins: odp: ipsec: Fix multiple issues
1) added casts on assignment to post_crypto.next_index as the type of the field changed 2) removed checking result when crypto operation is asynchronous as it make no sense 3) fixed bug which could cause issues when some of the operations are done synchronously and some asynchronously Change-Id: I123d70402c0210b11dfc2d0fff2c72aa100ce838 Signed-off-by: Szymon Sliwa <szs@semihalf.com>
-rw-r--r--src/plugins/odp/ipsec/esp_decrypt.c14
-rw-r--r--src/plugins/odp/ipsec/esp_encrypt.c13
2 files changed, 15 insertions, 12 deletions
diff --git a/src/plugins/odp/ipsec/esp_decrypt.c b/src/plugins/odp/ipsec/esp_decrypt.c
index 814c52b..20b3b30 100644
--- a/src/plugins/odp/ipsec/esp_decrypt.c
+++ b/src/plugins/odp/ipsec/esp_decrypt.c
@@ -128,7 +128,6 @@ esp_decrypt_node_fn (vlib_main_t * vm,
while (n_left_from > 0)
{
u32 n_left_to_next;
- u32 buffers_passed = 0;
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
@@ -317,7 +316,7 @@ esp_decrypt_node_fn (vlib_main_t * vm,
goto trace;
}
- if (PREDICT_FALSE (!result.ok))
+ if (PREDICT_FALSE (!posted && !result.ok))
{
vlib_node_increment_counter (vm, odp_crypto_esp_decrypt_node.index,
ESP_DECRYPT_ERROR_INTEG_ERROR,
@@ -405,7 +404,7 @@ esp_decrypt_node_fn (vlib_main_t * vm,
vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
- vnet_buffer (b0)->post_crypto.next_index = next0;
+ vnet_buffer (b0)->post_crypto.next_index = (u8) next0;
}
trace:
@@ -421,11 +420,14 @@ esp_decrypt_node_fn (vlib_main_t * vm,
{
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
n_left_to_next, bi0, next0);
- buffers_passed += 1;
+ }
+ else
+ {
+ to_next -= 1;
+ n_left_to_next += 1;
}
}
- if (buffers_passed > 0)
- vlib_put_next_frame (vm, node, next_index, n_left_to_next);
+ vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
vlib_node_increment_counter (vm, odp_crypto_esp_decrypt_node.index,
ESP_DECRYPT_ERROR_RX_PKTS,
diff --git a/src/plugins/odp/ipsec/esp_encrypt.c b/src/plugins/odp/ipsec/esp_encrypt.c
index 24e4018..4e1d34d 100644
--- a/src/plugins/odp/ipsec/esp_encrypt.c
+++ b/src/plugins/odp/ipsec/esp_encrypt.c
@@ -131,7 +131,6 @@ esp_encrypt_node_fn (vlib_main_t * vm,
while (n_left_from > 0)
{
u32 n_left_to_next;
- u32 buffers_passed = 0;
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
@@ -379,7 +378,7 @@ esp_encrypt_node_fn (vlib_main_t * vm,
b0->current_length +=
em->esp_integ_algs[sa0->integ_alg].trunc_size;
- vnet_buffer (b0)->post_crypto.next_index = next0;
+ vnet_buffer (b0)->post_crypto.next_index = (u8) next0;
int ret =
odp_crypto_operation (&crypto_op_params, &posted, &result);
@@ -430,12 +429,14 @@ esp_encrypt_node_fn (vlib_main_t * vm,
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
to_next, n_left_to_next, bi0,
next0);
- buffers_passed += 1;
}
-
+ else
+ {
+ to_next -= 1;
+ n_left_to_next += 1;
+ }
}
- if (buffers_passed > 0)
- vlib_put_next_frame (vm, node, next_index, n_left_to_next);
+ vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
vlib_node_increment_counter (vm, odp_crypto_esp_encrypt_node.index,
ESP_ENCRYPT_ERROR_RX_PKTS,