29 #define foreach_esp_encrypt_next \ 30 _(DROP4, "ip4-drop") \ 31 _(DROP6, "ip6-drop") \ 32 _(HANDOFF4, "handoff4") \ 33 _(HANDOFF6, "handoff6") \ 34 _(INTERFACE_OUTPUT, "interface-output") 36 #define _(v, s) ESP_ENCRYPT_NEXT_##v, 44 #define foreach_esp_encrypt_error \ 45 _(RX_PKTS, "ESP pkts received") \ 46 _(POST_RX_PKTS, "ESP-post pkts received") \ 47 _(SEQ_CYCLED, "sequence number cycled (packet dropped)") \ 48 _(CRYPTO_ENGINE_ERROR, "crypto engine error (packet dropped)") \ 49 _(CRYPTO_QUEUE_FULL, "crypto queue full (packet dropped)") \ 50 _(NO_BUFFERS, "no buffers (packet dropped)") \ 54 #define _(sym,str) ESP_ENCRYPT_ERROR_##sym, 61 #define _(sym,string) string, 73 ipsec_crypto_alg_t crypto_alg;
92 "esp: sa-index %d spi %u (0x%08x) seq %u sa-seq-hi %u crypto %U integrity %U%s",
96 t->
udp_encap ?
" udp-encap-enabled" :
"");
114 u8 esp_align,
u8 icv_sz,
116 u16 buffer_data_size,
uword total_len)
119 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
120 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00,
125 u8 pad_bytes = new_length - min_length;
130 if (last[0]->current_length + tail_sz > buffer_data_size)
138 last[0]->
flags |= VLIB_BUFFER_NEXT_PRESENT;
163 len = clib_net_to_host_u16 (len);
168 u8 prot = is_udp ? IP_PROTOCOL_UDP : IP_PROTOCOL_IPSEC_ESP;
187 udp->
length = clib_net_to_host_u16 (len);
193 #ifdef CLIB_HAVE_VEC128 194 static const u8x16 ext_hdr_types = {
195 IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS,
196 IP_PROTOCOL_IPV6_ROUTE,
197 IP_PROTOCOL_IPV6_FRAGMENTATION,
200 return !u8x16_is_all_zero (ext_hdr_types == u8x16_splat (nexthdr));
202 return ((nexthdr ^ IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) |
203 (nexthdr ^ IP_PROTOCOL_IPV6_ROUTE) |
204 (nexthdr ^ IP_PROTOCOL_IPV6_FRAGMENTATION) != 0);
223 p = (
void *) (ip6 + 1);
252 ASSERT (op - ops < n_ops);
254 if (op->
status != VNET_CRYPTO_OP_STATUS_COMPLETED)
257 b[bi]->
error = node->
errors[ESP_ENCRYPT_ERROR_CRYPTO_ENGINE_ERROR];
258 nexts[bi] = drop_next;
280 ASSERT (op - ops < n_ops);
282 if (op->
status != VNET_CRYPTO_OP_STATUS_COMPLETED)
285 b[bi]->
error = node->
errors[ESP_ENCRYPT_ERROR_CRYPTO_ENGINE_ERROR];
286 nexts[bi] = drop_next;
297 } __clib_packed esp_gcm_nonce_t;
305 u32 start_len,
u16 * n_ch)
312 total_len = ch->
len = start_len;
313 ch->
src = ch->
dst = start;
326 if (!(cb->
flags & VLIB_BUFFER_NEXT_PRESENT))
342 u32 start_len,
u8 * digest,
u16 * n_ch)
349 total_len = ch->
len = start_len;
360 if (ipsec_sa_is_set_USE_ESN (sa0))
362 u32 seq_hi = clib_net_to_host_u32 (sa0->
seq_hi);
364 ch->
len +=
sizeof (seq_hi);
365 total_len +=
sizeof (seq_hi);
372 if (!(cb->
flags & VLIB_BUFFER_NEXT_PRESENT))
388 u8 * payload,
u16 payload_len,
u8 iv_sz,
u8 icv_sz,
391 esp_gcm_nonce_t * nonce)
399 op->
src = op->
dst = payload;
401 op->
len = payload_len - icv_sz;
404 if (ipsec_sa_is_set_IS_AEAD (sa0))
413 op->
tag = payload + op->
len;
416 u64 *
iv = (
u64 *) (payload - iv_sz);
417 nonce->salt = sa0->
salt;
419 op->
iv = (
u8 *) nonce;
423 op->
iv = payload - iv_sz;
444 op->
digest = payload + payload_len - icv_sz;
459 payload_len + iv_sz +
463 else if (ipsec_sa_is_set_USE_ESN (sa0))
465 u32 seq_hi = clib_net_to_host_u32 (sa0->
seq_hi);
467 op->
len +=
sizeof (seq_hi);
481 u8 *tag, *
iv, *aad = 0;
484 i16 crypto_start_offset, integ_start_offset = 0;
485 u16 crypto_total_len, integ_total_len;
490 crypto_start_offset = payload - b->
data;
491 crypto_total_len = integ_total_len = payload_len - icv_sz;
492 tag = payload + crypto_total_len;
495 if (ipsec_sa_is_set_IS_AEAD (sa))
497 esp_gcm_nonce_t *nonce;
498 u64 *pkt_iv = (
u64 *) (payload - iv_sz);
500 aad = payload - hdr_len -
sizeof (
esp_aead_t);
502 nonce = (esp_gcm_nonce_t *) (aad -
sizeof (*nonce));
503 nonce->salt = sa->
salt;
504 nonce->iv = *pkt_iv = clib_host_to_net_u64 (sa->
gcm_iv_counter++);
521 iv = payload - iv_sz;
522 integ_start_offset = crypto_start_offset - iv_sz -
sizeof (
esp_header_t);
537 payload_len + iv_sz +
541 else if (ipsec_sa_is_set_USE_ESN (sa) && !ipsec_sa_is_set_IS_AEAD (sa))
543 u32 seq_hi = clib_net_to_host_u32 (sa->
seq_hi);
545 integ_total_len +=
sizeof (seq_hi);
551 integ_total_len - crypto_total_len,
553 integ_start_offset, bi, async_next,
571 u32 current_sa_index = ~0, current_sa_packets = 0;
572 u32 current_sa_bytes = 0,
spi = 0;
573 u8 esp_align = 4, iv_sz = 0, icv_sz = 0;
581 u16 drop_next = (is_ip6 ? ESP_ENCRYPT_NEXT_DROP6 : ESP_ENCRYPT_NEXT_DROP4);
582 u16 n_async_drop = 0;
599 u8 *payload, *next_hdr_ptr;
600 u16 payload_len, payload_len_total, n_bufs;
626 if (sa_index0 != current_sa_index)
628 if (current_sa_packets)
633 current_sa_packets = current_sa_bytes = 0;
640 current_sa_index = sa_index0;
641 spi = clib_net_to_host_u32 (sa0->
spi);
649 if (async_frame && async_frame->
n_elts)
653 nexts, &n_async_drop,
655 ESP_ENCRYPT_ERROR_CRYPTO_ENGINE_ERROR);
676 (is_ip6 ? ESP_ENCRYPT_NEXT_HANDOFF6 :
677 ESP_ENCRYPT_NEXT_HANDOFF4), next);
685 b[0]->
error = node->
errors[ESP_ENCRYPT_ERROR_NO_BUFFERS];
687 &n_async_drop, drop_next, next);
694 while (lb->
flags & VLIB_BUFFER_NEXT_PRESENT)
700 b[0]->
error = node->
errors[ESP_ENCRYPT_ERROR_SEQ_CYCLED];
702 &n_async_drop, drop_next, next);
709 if (ipsec_sa_is_set_IS_TUNNEL (sa0))
719 b[0]->
error = node->
errors[ESP_ENCRYPT_ERROR_NO_BUFFERS];
721 &n_async_drop, drop_next, next);
724 b[0]->
flags &= ~VLIB_BUFFER_TOTAL_LENGTH_VALID;
729 hdr_len +=
sizeof (*esp);
733 if (ipsec_sa_is_set_UDP_ENCAP (sa0))
737 payload_len_total + hdr_len);
741 if (ipsec_sa_is_set_IS_TUNNEL_V6 (sa0))
751 *next_hdr_ptr = IP_PROTOCOL_IPV6;
758 *next_hdr_ptr = IP_PROTOCOL_IP_IN_IP;
763 len = payload_len_total + hdr_len -
len;
776 *next_hdr_ptr = IP_PROTOCOL_IPV6;
783 *next_hdr_ptr = IP_PROTOCOL_IP_IN_IP;
788 len = payload_len_total + hdr_len;
799 next[0] = ESP_ENCRYPT_NEXT_INTERFACE_OUTPUT;
803 u8 *l2_hdr, l2_len, *ip_hdr, ip_len;
804 ip6_ext_header_t *ext_hdr;
823 &n_async_drop, drop_next, next);
827 b[0]->
flags &= ~VLIB_BUFFER_TOTAL_LENGTH_VALID;
832 hdr_len +=
sizeof (*esp);
836 if (ipsec_sa_is_set_UDP_ENCAP (sa0))
844 ip_hdr = payload - hdr_len;
849 l2_len =
vnet_buffer (b[0])->ip.save_rewrite_length;
851 l2_hdr = payload - hdr_len;
865 ip6->
protocol = IP_PROTOCOL_IPSEC_ESP;
869 *next_hdr_ptr = ext_hdr->next_hdr;
870 ext_hdr->next_hdr = IP_PROTOCOL_IPSEC_ESP;
873 clib_host_to_net_u16 (payload_len_total + hdr_len - l2_len -
881 len = payload_len_total + hdr_len - l2_len;
885 udp_len = len - ip_len;
898 next[0] = ESP_ENCRYPT_NEXT_INTERFACE_OUTPUT;
913 esp->
seq = clib_net_to_host_u32 (sa0->
seq);
920 &n_async_drop, drop_next, next);
925 payload, payload_len, iv_sz,
926 icv_sz, from[b - bufs], next[0],
927 hdr_len, async_next, lb))
932 &n_async_drop, drop_next,
933 ESP_ENCRYPT_ERROR_CRYPTO_ENGINE_ERROR);
934 b[0]->
error = ESP_ENCRYPT_ERROR_CRYPTO_ENGINE_ERROR;
936 &n_async_drop, drop_next, next);
943 payload_len, iv_sz, icv_sz, bufs, b, lb,
944 hdr_len, esp, nonce++);
949 current_sa_packets += 1;
950 current_sa_bytes += payload_len_total;
961 tr->
udp_encap = ipsec_sa_is_set_UDP_ENCAP (sa0);
972 current_sa_index, current_sa_packets,
986 if (async_frame && async_frame->
n_elts)
990 &n_async_drop, drop_next,
991 ESP_ENCRYPT_ERROR_CRYPTO_ENGINE_ERROR);
994 ESP_ENCRYPT_ERROR_RX_PKTS,
1003 ESP_ENCRYPT_ERROR_RX_PKTS, frame->
n_vectors);
1042 if (b[0]->
flags & VLIB_BUFFER_IS_TRACED)
1048 if (b[1]->
flags & VLIB_BUFFER_IS_TRACED)
1054 if (b[2]->
flags & VLIB_BUFFER_IS_TRACED)
1060 if (b[3]->
flags & VLIB_BUFFER_IS_TRACED)
1089 ESP_ENCRYPT_ERROR_POST_RX_PKTS,
1105 .name =
"esp4-encrypt",
1106 .vector_size =
sizeof (
u32),
1115 [ESP_ENCRYPT_NEXT_DROP4] =
"ip4-drop",
1116 [ESP_ENCRYPT_NEXT_DROP6] =
"ip6-drop",
1117 [ESP_ENCRYPT_NEXT_HANDOFF4] =
"esp4-encrypt-handoff",
1118 [ESP_ENCRYPT_NEXT_HANDOFF6] =
"esp6-encrypt-handoff",
1119 [ESP_ENCRYPT_NEXT_INTERFACE_OUTPUT] =
"interface-output" 1133 .name =
"esp4-encrypt-post",
1134 .vector_size =
sizeof (
u32),
1137 .sibling_of =
"esp4-encrypt",
1154 .name =
"esp6-encrypt",
1155 .vector_size =
sizeof (
u32),
1158 .sibling_of =
"esp4-encrypt",
1174 .name =
"esp6-encrypt-post",
1175 .vector_size =
sizeof (
u32),
1178 .sibling_of =
"esp4-encrypt",
1195 .name =
"esp4-encrypt-tun",
1196 .vector_size =
sizeof (
u32),
1205 [ESP_ENCRYPT_NEXT_DROP4] =
"ip4-drop",
1206 [ESP_ENCRYPT_NEXT_DROP6] =
"ip6-drop",
1207 [ESP_ENCRYPT_NEXT_HANDOFF4] =
"esp4-encrypt-tun-handoff",
1208 [ESP_ENCRYPT_NEXT_HANDOFF6] =
"error-drop",
1209 [ESP_ENCRYPT_NEXT_INTERFACE_OUTPUT] =
"adj-midchain-tx",
1222 .name =
"esp4-encrypt-tun-post",
1223 .vector_size =
sizeof (
u32),
1226 .sibling_of =
"esp4-encrypt-tun",
1243 .name =
"esp6-encrypt-tun",
1244 .vector_size =
sizeof (
u32),
1253 [ESP_ENCRYPT_NEXT_DROP4] =
"ip4-drop",
1254 [ESP_ENCRYPT_NEXT_DROP6] =
"ip6-drop",
1255 [ESP_ENCRYPT_NEXT_HANDOFF4] =
"error-drop",
1256 [ESP_ENCRYPT_NEXT_HANDOFF6] =
"esp6-encrypt-tun-handoff",
1257 [ESP_ENCRYPT_NEXT_INTERFACE_OUTPUT] =
"adj-midchain-tx",
1272 .name =
"esp6-encrypt-tun-post",
1273 .vector_size =
sizeof (
u32),
1276 .sibling_of =
"esp6-encrypt-tun",
1312 "Outbound ESP packets received",
1364 .name =
"esp4-no-crypto",
1365 .vector_size =
sizeof (
u32),
1385 .name =
"esp6-no-crypto",
1386 .vector_size =
sizeof (
u32),
u32 vnet_crypto_process_ops(vlib_main_t *vm, vnet_crypto_op_t ops[], u32 n_ops)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static_always_inline int vnet_crypto_async_add_to_frame(vlib_main_t *vm, vnet_crypto_async_frame_t **frame, u32 key_index, u32 crypto_len, i16 integ_len_adj, i16 crypto_start_offset, u16 integ_start_offset, u32 buffer_index, u16 next_node, u8 *iv, u8 *tag, u8 *aad, u8 flags)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
static u8 * vlib_buffer_get_tail(vlib_buffer_t *b)
Get pointer to the end of buffer's data.
ipsec_per_thread_data_t * ptd
vnet_crypto_op_t * integ_ops
vl_api_wireguard_peer_flags_t flags
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
static_always_inline u8 esp_get_ip6_hdr_len(ip6_header_t *ip6, ip6_ext_header_t **ext_hdr)
static char * esp_no_crypto_error_strings[]
static u16 esp_aad_fill(u8 *data, const esp_header_t *esp, const ipsec_sa_t *sa)
vl_api_ip_proto_t protocol
#define clib_memcpy_fast(a, b, c)
#define VNET_CRYPTO_OP_FLAG_CHAINED_BUFFERS
static u32 ipsec_sa_assign_thread(u32 thread_id)
#define vec_add2_aligned(V, P, N, A)
Add N elements to end of vector V, return pointer to new elements in P.
ipsec_integ_alg_t integ_alg
u16 current_length
Nbytes between current data and the end of this buffer.
vnet_crypto_op_t * crypto_ops
struct esp_aead_t_ esp_aead_t
AES GCM Additional Authentication data.
static heap_elt_t * last(heap_header_t *h)
static void * ip6_ext_next_header(ip6_ext_header_t *ext_hdr)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static u8 * format_esp_encrypt_trace(u8 *s, va_list *args)
ipsec_integ_alg_t integ_alg
ipsec_crypto_alg_t crypto_alg
#define VLIB_NODE_FN(node)
vnet_crypto_op_chunk_t * chunks
static_always_inline void esp_process_chained_ops(vlib_main_t *vm, vlib_node_runtime_t *node, vnet_crypto_op_t *ops, vlib_buffer_t *b[], u16 *nexts, vnet_crypto_op_chunk_t *chunks, u16 drop_next)
vlib_error_t * errors
Vector of errors for this node.
vnet_crypto_op_id_t integ_op_id
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
vlib_node_registration_t esp4_encrypt_tun_node
(constructor) VLIB_REGISTER_NODE (esp4_encrypt_tun_node)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static int esp_seq_advance(ipsec_sa_t *sa)
vnet_crypto_key_index_t linked_key_index
vnet_crypto_key_index_t crypto_key_index
static uword esp_no_crypto_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define static_always_inline
#define foreach_esp_encrypt_next
static u8 * format_esp_post_encrypt_trace(u8 *s, va_list *args)
static_always_inline void tunnel_encap_fixup_6o6(tunnel_encap_decap_flags_t flags, const ip6_header_t *inner, ip6_header_t *outer)
description fragment has unexpected format
static_always_inline void esp_fill_udp_hdr(ipsec_sa_t *sa, udp_header_t *udp, u16 len)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
tunnel_encap_decap_flags_t tunnel_flags
static_always_inline void vnet_crypto_op_init(vnet_crypto_op_t *op, vnet_crypto_op_id_t type)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static_always_inline void vlib_buffer_enqueue_to_single_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 next_index, u32 count)
static_always_inline u8 ext_hdr_is_pre_esp(u8 nexthdr)
static const u8 pad_data[]
STATIC_ASSERT_SIZEOF(esp_gcm_nonce_t, 12)
static u8 * format_esp_no_crypto_trace(u8 *s, va_list *args)
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void esp_async_recycle_failed_submit(vnet_crypto_async_frame_t *f, vlib_buffer_t **b, u32 *from, u16 *nexts, u16 *n_dropped, u16 drop_next_index, vlib_error_t err)
static_always_inline u32 esp_encrypt_chain_integ(vlib_main_t *vm, ipsec_per_thread_data_t *ptd, ipsec_sa_t *sa0, vlib_buffer_t *b, vlib_buffer_t *lb, u8 icv_sz, u8 *start, u32 start_len, u8 *digest, u16 *n_ch)
vlib_node_registration_t esp6_encrypt_node
(constructor) VLIB_REGISTER_NODE (esp6_encrypt_node)
static u32 vlib_buffer_chain_linearize(vlib_main_t *vm, vlib_buffer_t *b)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static_always_inline void tunnel_encap_fixup_4o6(tunnel_encap_decap_flags_t flags, const ip4_header_t *inner, ip6_header_t *outer)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_node_registration_t esp6_encrypt_tun_node
(constructor) VLIB_REGISTER_NODE (esp6_encrypt_tun_node)
static index_t ipsec_tun_protect_get_sa_out(adj_index_t ai)
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
esp_async_post_next_t esp_encrypt_async_next
vlib_node_registration_t esp4_no_crypto_tun_node
(constructor) VLIB_REGISTER_NODE (esp4_no_crypto_tun_node)
static void esp_prepare_sync_op(vlib_main_t *vm, ipsec_per_thread_data_t *ptd, vnet_crypto_op_t **crypto_ops, vnet_crypto_op_t **integ_ops, ipsec_sa_t *sa0, u8 *payload, u16 payload_len, u8 iv_sz, u8 icv_sz, vlib_buffer_t **bufs, vlib_buffer_t **b, vlib_buffer_t *lb, u32 hdr_len, esp_header_t *esp, esp_gcm_nonce_t *nonce)
u32 node_index
Node index.
static char * esp_encrypt_error_strings[]
static_always_inline u32 esp_encrypt_chain_crypto(vlib_main_t *vm, ipsec_per_thread_data_t *ptd, ipsec_sa_t *sa0, vlib_buffer_t *b, vlib_buffer_t *lb, u8 icv_sz, u8 *start, u32 start_len, u16 *n_ch)
static uword esp_encrypt_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_ip6, int is_tun, u16 async_next)
static_always_inline vnet_crypto_async_frame_t * vnet_crypto_async_get_frame(vlib_main_t *vm, vnet_crypto_async_op_id_t opt)
async crypto inline functions
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define ip6_ext_header_len(p)
vnet_crypto_op_t * chained_crypto_ops
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
#define VLIB_REGISTER_NODE(x,...)
#define VNET_CRYPTO_OP_FLAG_INIT_IV
#define CLIB_PREFETCH(addr, size, type)
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
vlib_node_registration_t esp6_no_crypto_tun_node
(constructor) VLIB_REGISTER_NODE (esp6_no_crypto_tun_node)
vlib_node_registration_t esp4_encrypt_node
(constructor) VLIB_REGISTER_NODE (esp4_encrypt_node)
static uword round_pow2(uword x, uword pow2)
vlib_node_registration_t esp4_encrypt_post_node
(constructor) VLIB_REGISTER_NODE (esp4_encrypt_post_node)
vlib_node_registration_t esp6_encrypt_post_node
(constructor) VLIB_REGISTER_NODE (esp6_encrypt_post_node)
vlib_node_registration_t esp6_encrypt_tun_post_node
(constructor) VLIB_REGISTER_NODE (esp6_encrypt_tun_post_node)
#define ESP_MAX_BLOCK_SIZE
vlib_main_t vlib_node_runtime_t * node
#define clib_atomic_cmp_and_swap(addr, old, new)
static uword esp_encrypt_post_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_combined_counter_main_t ipsec_sa_counters
SA packet & bytes counters.
u32 vnet_crypto_process_chained_ops(vlib_main_t *vm, vnet_crypto_op_t ops[], vnet_crypto_op_chunk_t *chunks, u32 n_ops)
static_always_inline void esp_update_ip4_hdr(ip4_header_t *ip4, u16 len, int is_transport, int is_udp)
static_always_inline void esp_process_ops(vlib_main_t *vm, vlib_node_runtime_t *node, vnet_crypto_op_t *ops, vlib_buffer_t *b[], u16 *nexts, u16 drop_next)
static_always_inline u8 * esp_add_footer_and_icv(vlib_main_t *vm, vlib_buffer_t **last, u8 esp_align, u8 icv_sz, u16 *next, vlib_node_runtime_t *node, u16 buffer_data_size, uword total_len)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vnet_crypto_async_op_id_t
vnet_crypto_key_index_t integ_key_index
static_always_inline int vnet_crypto_async_submit_open_frame(vlib_main_t *vm, vnet_crypto_async_frame_t *frame)
static_always_inline void clib_memcpy_le64(u8 *dst, u8 *src, u8 len)
index_t dpoi_index
the index of objects of that type
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 next_buffer
Next buffer for this linked-list of buffers.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define ip_csum_update(sum, old, new, type, field)
vnet_crypto_op_id_t crypto_enc_op_id
vnet_crypto_op_t * chained_integ_ops
vnet_crypto_op_status_t status
static_always_inline void tunnel_encap_fixup_6o4_w_chksum(tunnel_encap_decap_flags_t flags, const ip6_header_t *inner, ip4_header_t *outer)
ipsec_crypto_alg_t crypto_alg
vlib_node_registration_t esp4_encrypt_tun_post_node
(constructor) VLIB_REGISTER_NODE (esp4_encrypt_tun_post_node)
vnet_crypto_async_op_id_t crypto_async_enc_op_id
static_always_inline void tunnel_encap_fixup_4o4_w_chksum(tunnel_encap_decap_flags_t flags, const ip4_header_t *inner, ip4_header_t *outer)
u16 flags
Copy of main node flags.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u16 dpoi_next_node
The next VLIB node to follow.
static int ip4_header_bytes(const ip4_header_t *i)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
#define foreach_esp_encrypt_error
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip_csum_fold(ip_csum_t c)
static void esp_set_next_index(int is_async, u32 *from, u16 *nexts, u32 bi, u16 *drop_index, u16 drop_next, u16 *next)
static_always_inline void clib_memcpy_le32(u8 *dst, u8 *src, u8 len)
static_always_inline int esp_prepare_async_frame(vlib_main_t *vm, ipsec_per_thread_data_t *ptd, vnet_crypto_async_frame_t **async_frame, ipsec_sa_t *sa, vlib_buffer_t *b, esp_header_t *esp, u8 *payload, u32 payload_len, u8 iv_sz, u8 icv_sz, u32 bi, u16 next, u32 hdr_len, u16 async_next, vlib_buffer_t *lb)