X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fipsec%2Fesp.h;h=bc67f9d078386ddaed096ffb7a62390f8a1075b4;hb=71612d61930e57e7c8ebf9e5647b15a4b23720b2;hp=50cac806d14e5d385ce42645653ac4048dbff209;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vnet/ipsec/esp.h b/src/vnet/ipsec/esp.h index 50cac806d14..bc67f9d0783 100644 --- a/src/vnet/ipsec/esp.h +++ b/src/vnet/ipsec/esp.h @@ -15,6 +15,9 @@ #ifndef __ESP_H__ #define __ESP_H__ +#include +#include + #include #include #include @@ -77,11 +80,12 @@ typedef struct esp_main_per_thread_data_t *per_thread_data; } esp_main_t; -esp_main_t esp_main; +extern esp_main_t esp_main; #define ESP_WINDOW_SIZE (64) #define ESP_SEQ_MAX (4294967295UL) +u8 *format_esp_header (u8 * s, va_list * args); always_inline int esp_replay_check (ipsec_sa_t * sa, u32 seq) @@ -282,8 +286,8 @@ hmac_calc (ipsec_integ_alg_t alg, u8 * data, int data_len, u8 * signature, u8 use_esn, u32 seq_hi) { esp_main_t *em = &esp_main; - u32 cpu_index = os_get_cpu_number (); - HMAC_CTX *ctx = &(em->per_thread_data[cpu_index].hmac_ctx); + u32 thread_index = vlib_get_thread_index (); + HMAC_CTX *ctx = &(em->per_thread_data[thread_index].hmac_ctx); const EVP_MD *md = NULL; unsigned int len; @@ -292,10 +296,10 @@ hmac_calc (ipsec_integ_alg_t alg, if (PREDICT_FALSE (em->esp_integ_algs[alg].md == 0)) return 0; - if (PREDICT_FALSE (alg != em->per_thread_data[cpu_index].last_integ_alg)) + if (PREDICT_FALSE (alg != em->per_thread_data[thread_index].last_integ_alg)) { md = em->esp_integ_algs[alg].md; - em->per_thread_data[cpu_index].last_integ_alg = alg; + em->per_thread_data[thread_index].last_integ_alg = alg; } HMAC_Init (ctx, key, key_len, md);