diff options
-rw-r--r-- | vnet/vnet/ipsec/esp_decrypt.c | 3 | ||||
-rw-r--r-- | vnet/vnet/ipsec/esp_encrypt.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/vnet/vnet/ipsec/esp_decrypt.c b/vnet/vnet/ipsec/esp_decrypt.c index 7af88b23..8d94f20e 100644 --- a/vnet/vnet/ipsec/esp_decrypt.c +++ b/vnet/vnet/ipsec/esp_decrypt.c @@ -237,10 +237,11 @@ esp_decrypt_node_fn (vlib_main_t * vm, from = vlib_frame_vector_args (from_frame); n_left_from = from_frame->n_vectors; u32 cpu_index = os_get_cpu_number(); - u32 * empty_buffers = im->empty_buffers[cpu_index]; ipsec_alloc_empty_buffers(vm, im); + u32 * empty_buffers = im->empty_buffers[cpu_index]; + if (PREDICT_FALSE(vec_len (empty_buffers) < n_left_from)){ vlib_node_increment_counter (vm, esp_decrypt_node.index, ESP_DECRYPT_ERROR_NO_BUFFER, n_left_from); diff --git a/vnet/vnet/ipsec/esp_encrypt.c b/vnet/vnet/ipsec/esp_encrypt.c index c81a8781..ff0688c2 100644 --- a/vnet/vnet/ipsec/esp_encrypt.c +++ b/vnet/vnet/ipsec/esp_encrypt.c @@ -144,10 +144,11 @@ esp_encrypt_node_fn (vlib_main_t * vm, ipsec_main_t *im = &ipsec_main; u32 * recycle = 0; u32 cpu_index = os_get_cpu_number(); - u32 * empty_buffers = im->empty_buffers[cpu_index]; ipsec_alloc_empty_buffers(vm, im); + u32 * empty_buffers = im->empty_buffers[cpu_index]; + if (PREDICT_FALSE(vec_len (empty_buffers) < n_left_from)){ vlib_node_increment_counter (vm, esp_encrypt_node.index, ESP_ENCRYPT_ERROR_NO_BUFFER, n_left_from); |