2 * esp_encrypt.c : IPSec ESP encrypt node
4 * Copyright (c) 2015 Cisco and/or its affiliates.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include <vnet/vnet.h>
19 #include <vnet/api_errno.h>
20 #include <vnet/ip/ip.h>
21 #include <vnet/udp/udp.h>
23 #include <vnet/crypto/crypto.h>
25 #include <vnet/ipsec/ipsec.h>
26 #include <vnet/ipsec/esp.h>
28 #define foreach_esp_encrypt_next \
29 _(DROP, "error-drop") \
30 _(IP4_LOOKUP, "ip4-lookup") \
31 _(IP6_LOOKUP, "ip6-lookup") \
32 _(INTERFACE_OUTPUT, "interface-output")
34 #define _(v, s) ESP_ENCRYPT_NEXT_##v,
37 foreach_esp_encrypt_next
42 #define foreach_esp_encrypt_error \
43 _(RX_PKTS, "ESP pkts received") \
44 _(SEQ_CYCLED, "sequence number cycled (packet dropped)") \
45 _(CRYPTO_ENGINE_ERROR, "crypto engine error (packet dropped)") \
46 _(CHAINED_BUFFER, "chained buffers (packet dropped)") \
47 _(NO_TRAILER_SPACE, "no trailer space (packet dropped)")
51 #define _(sym,str) ESP_ENCRYPT_ERROR_##sym,
52 foreach_esp_encrypt_error
55 } esp_encrypt_error_t;
57 static char *esp_encrypt_error_strings[] = {
58 #define _(sym,string) string,
59 foreach_esp_encrypt_error
70 ipsec_crypto_alg_t crypto_alg;
71 ipsec_integ_alg_t integ_alg;
72 } esp_encrypt_trace_t;
74 /* packet trace format function */
76 format_esp_encrypt_trace (u8 * s, va_list * args)
78 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
79 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
80 esp_encrypt_trace_t *t = va_arg (*args, esp_encrypt_trace_t *);
84 "esp: sa-index %d spi %u (0x%08x) seq %u sa-seq-hi %u crypto %U integrity %U%s",
85 t->sa_index, t->spi, t->spi, t->seq, t->sa_seq_hi,
86 format_ipsec_crypto_alg,
87 t->crypto_alg, format_ipsec_integ_alg, t->integ_alg,
88 t->udp_encap ? " udp-encap-enabled" : "");
92 /* pad packet in input buffer */
93 static_always_inline u8 *
94 esp_add_footer_and_icv (vlib_buffer_t * b, u8 block_size, u8 icv_sz)
96 static const u8 pad_data[ESP_MAX_BLOCK_SIZE] = {
97 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
98 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x00, 0x00,
101 u16 min_length = b->current_length + sizeof (esp_footer_t);
102 u16 new_length = round_pow2 (min_length, block_size);
103 u8 pad_bytes = new_length - min_length;
104 esp_footer_t *f = (esp_footer_t *) (vlib_buffer_get_current (b) +
105 new_length - sizeof (esp_footer_t));
108 clib_memcpy_fast ((u8 *) f - pad_bytes, pad_data, ESP_MAX_BLOCK_SIZE);
110 f->pad_length = pad_bytes;
111 b->current_length = new_length + icv_sz;
112 return &f->next_header;
115 static_always_inline void
116 esp_update_ip4_hdr (ip4_header_t * ip4, u16 len, int is_transport, int is_udp)
121 len = clib_net_to_host_u16 (len);
122 old_len = ip4->length;
126 u8 prot = is_udp ? IP_PROTOCOL_UDP : IP_PROTOCOL_IPSEC_ESP;
128 sum = ip_csum_update (ip4->checksum, ip4->protocol,
129 prot, ip4_header_t, protocol);
130 ip4->protocol = prot;
132 sum = ip_csum_update (sum, old_len, len, ip4_header_t, length);
135 sum = ip_csum_update (ip4->checksum, old_len, len, ip4_header_t, length);
138 ip4->checksum = ip_csum_fold (sum);
141 static_always_inline void
142 esp_fill_udp_hdr (ipsec_sa_t * sa, udp_header_t * udp, u16 len)
144 clib_memcpy_fast (udp, &sa->udp_hdr, sizeof (udp_header_t));
145 udp->length = clib_net_to_host_u16 (len);
148 static_always_inline u8
149 ext_hdr_is_pre_esp (u8 nexthdr)
151 #ifdef CLIB_HAVE_VEC128
152 static const u8x16 ext_hdr_types = {
153 IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS,
154 IP_PROTOCOL_IPV6_ROUTE,
155 IP_PROTOCOL_IPV6_FRAGMENTATION,
158 return !u8x16_is_all_zero (ext_hdr_types == u8x16_splat (nexthdr));
160 return ((nexthdr ^ IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) |
161 (nexthdr ^ IP_PROTOCOL_IPV6_ROUTE) |
162 (nexthdr ^ IP_PROTOCOL_IPV6_FRAGMENTATION) != 0);
166 static_always_inline u8
167 esp_get_ip6_hdr_len (ip6_header_t * ip6)
169 /* this code assumes that HbH, route and frag headers will be before
170 others, if that is not the case, they will end up encrypted */
172 u8 len = sizeof (ip6_header_t);
175 /* if next packet doesn't have ext header */
176 if (ext_hdr_is_pre_esp (ip6->protocol) == 0)
179 p = (void *) (ip6 + 1);
180 len += ip6_ext_header_len (p);
182 while (ext_hdr_is_pre_esp (p->next_hdr))
184 len += ip6_ext_header_len (p);
185 p = ip6_ext_next_header (p);
191 static_always_inline int
192 esp_trailer_icv_overflow (vlib_node_runtime_t * node, vlib_buffer_t * b,
193 u16 * next, u16 buffer_data_size)
195 if (b->current_data + b->current_length <= buffer_data_size)
198 b->current_length -= buffer_data_size - b->current_data;
199 b->error = node->errors[ESP_ENCRYPT_ERROR_NO_TRAILER_SPACE];
200 next[0] = ESP_ENCRYPT_NEXT_DROP;
204 static_always_inline void
205 esp_process_ops (vlib_main_t * vm, vlib_node_runtime_t * node,
206 vnet_crypto_op_t * ops, vlib_buffer_t * b[], u16 * nexts)
208 u32 n_fail, n_ops = vec_len (ops);
209 vnet_crypto_op_t *op = ops;
214 n_fail = n_ops - vnet_crypto_process_ops (vm, op, n_ops);
218 ASSERT (op - ops < n_ops);
220 if (op->status != VNET_CRYPTO_OP_STATUS_COMPLETED)
222 u32 bi = op->user_data;
223 b[bi]->error = node->errors[ESP_ENCRYPT_ERROR_CRYPTO_ENGINE_ERROR];
224 nexts[bi] = ESP_ENCRYPT_NEXT_DROP;
235 } __clib_packed esp_gcm_nonce_t;
237 STATIC_ASSERT_SIZEOF (esp_gcm_nonce_t, 12);
240 esp_encrypt_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
241 vlib_frame_t * frame, int is_ip6, int is_tun)
243 ipsec_main_t *im = &ipsec_main;
244 ipsec_per_thread_data_t *ptd = vec_elt_at_index (im->ptd, vm->thread_index);
245 u32 *from = vlib_frame_vector_args (frame);
246 u32 n_left = frame->n_vectors;
247 vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
248 u16 nexts[VLIB_FRAME_SIZE], *next = nexts;
249 esp_gcm_nonce_t nonces[VLIB_FRAME_SIZE], *nonce = nonces;
250 u32 thread_index = vm->thread_index;
251 u16 buffer_data_size = vlib_buffer_get_default_data_size (vm);
252 u32 current_sa_index = ~0, current_sa_packets = 0;
253 u32 current_sa_bytes = 0, spi = 0;
254 u8 block_sz = 0, iv_sz = 0, icv_sz = 0;
257 vlib_get_buffers (vm, from, b, n_left);
258 vec_reset_length (ptd->crypto_ops);
259 vec_reset_length (ptd->integ_ops);
266 u8 *payload, *next_hdr_ptr;
273 vlib_prefetch_buffer_header (b[2], LOAD);
274 p = vlib_buffer_get_current (b[1]);
275 CLIB_PREFETCH (p, CLIB_CACHE_LINE_BYTES, LOAD);
276 p -= CLIB_CACHE_LINE_BYTES;
277 CLIB_PREFETCH (p, CLIB_CACHE_LINE_BYTES, LOAD);
282 /* we are on a ipsec tunnel's feature arc */
284 sa_index0 = *(u32 *) vnet_feature_next_with_data (&next0, b[0],
290 sa_index0 = vnet_buffer (b[0])->ipsec.sad_index;
292 if (sa_index0 != current_sa_index)
294 if (current_sa_packets)
295 vlib_increment_combined_counter (&ipsec_sa_counters, thread_index,
299 current_sa_packets = current_sa_bytes = 0;
301 sa0 = pool_elt_at_index (im->sad, sa_index0);
302 current_sa_index = sa_index0;
303 spi = clib_net_to_host_u32 (sa0->spi);
304 block_sz = sa0->crypto_block_size;
305 icv_sz = sa0->integ_icv_size;
306 iv_sz = sa0->crypto_iv_size;
309 if (vlib_buffer_chain_linearize (vm, b[0]) != 1)
311 b[0]->error = node->errors[ESP_ENCRYPT_ERROR_CHAINED_BUFFER];
312 next[0] = ESP_ENCRYPT_NEXT_DROP;
316 if (PREDICT_FALSE (esp_seq_advance (sa0)))
318 b[0]->error = node->errors[ESP_ENCRYPT_ERROR_SEQ_CYCLED];
319 next[0] = ESP_ENCRYPT_NEXT_DROP;
326 if (ipsec_sa_is_set_IS_TUNNEL (sa0))
328 payload = vlib_buffer_get_current (b[0]);
329 next_hdr_ptr = esp_add_footer_and_icv (b[0], block_sz, icv_sz);
330 payload_len = b[0]->current_length;
332 if (esp_trailer_icv_overflow (node, b[0], next, buffer_data_size))
336 hdr_len += sizeof (*esp);
337 esp = (esp_header_t *) (payload - hdr_len);
339 /* optional UDP header */
340 if (ipsec_sa_is_set_UDP_ENCAP (sa0))
342 hdr_len += sizeof (udp_header_t);
343 esp_fill_udp_hdr (sa0, (udp_header_t *) (payload - hdr_len),
344 payload_len + hdr_len);
348 if (ipsec_sa_is_set_IS_TUNNEL_V6 (sa0))
351 u16 len = sizeof (ip6_header_t);
353 ip6 = (ip6_header_t *) (payload - hdr_len);
354 clib_memcpy_fast (ip6, &sa0->ip6_hdr, len);
355 *next_hdr_ptr = (is_ip6 ?
356 IP_PROTOCOL_IPV6 : IP_PROTOCOL_IP_IN_IP);
357 len = payload_len + hdr_len - len;
358 ip6->payload_length = clib_net_to_host_u16 (len);
363 u16 len = sizeof (ip4_header_t);
365 ip4 = (ip4_header_t *) (payload - hdr_len);
366 clib_memcpy_fast (ip4, &sa0->ip4_hdr, len);
367 *next_hdr_ptr = (is_ip6 ?
368 IP_PROTOCOL_IPV6 : IP_PROTOCOL_IP_IN_IP);
369 len = payload_len + hdr_len;
370 esp_update_ip4_hdr (ip4, len, /* is_transport */ 0, 0);
376 next[0] = dpo->dpoi_next_node;
377 vnet_buffer (b[0])->ip.adj_index[VLIB_TX] = dpo->dpoi_index;
380 else /* transport mode */
382 u8 *l2_hdr, l2_len, *ip_hdr, ip_len;
383 udp_header_t *udp = 0;
384 u8 *old_ip_hdr = vlib_buffer_get_current (b[0]);
387 esp_get_ip6_hdr_len ((ip6_header_t *) old_ip_hdr) :
388 ip4_header_bytes ((ip4_header_t *) old_ip_hdr);
390 vlib_buffer_advance (b[0], ip_len);
391 payload = vlib_buffer_get_current (b[0]);
392 next_hdr_ptr = esp_add_footer_and_icv (b[0], block_sz, icv_sz);
393 payload_len = b[0]->current_length;
395 if (esp_trailer_icv_overflow (node, b[0], next, buffer_data_size))
399 hdr_len += sizeof (*esp);
400 esp = (esp_header_t *) (payload - hdr_len);
402 /* optional UDP header */
403 if (ipsec_sa_is_set_UDP_ENCAP (sa0))
405 hdr_len += sizeof (udp_header_t);
406 udp = (udp_header_t *) (payload - hdr_len);
411 ip_hdr = payload - hdr_len;
416 l2_len = vnet_buffer (b[0])->ip.save_rewrite_length;
418 l2_hdr = payload - hdr_len;
420 /* copy l2 and ip header */
421 clib_memcpy_le32 (l2_hdr, old_ip_hdr - l2_len, l2_len);
426 clib_memcpy_le64 (ip_hdr, old_ip_hdr, ip_len);
430 ip6_header_t *ip6 = (ip6_header_t *) (ip_hdr);
431 *next_hdr_ptr = ip6->protocol;
432 ip6->protocol = IP_PROTOCOL_IPSEC_ESP;
433 ip6->payload_length =
434 clib_host_to_net_u16 (payload_len + hdr_len - l2_len -
440 ip4_header_t *ip4 = (ip4_header_t *) (ip_hdr);
441 *next_hdr_ptr = ip4->protocol;
442 len = payload_len + hdr_len - l2_len;
445 esp_update_ip4_hdr (ip4, len, /* is_transport */ 1, 1);
446 esp_fill_udp_hdr (sa0, udp, len - ip_len);
449 esp_update_ip4_hdr (ip4, len, /* is_transport */ 1, 0);
453 next[0] = ESP_ENCRYPT_NEXT_INTERFACE_OUTPUT;
457 esp->seq = clib_net_to_host_u32 (sa0->seq);
459 if (sa0->crypto_enc_op_id)
461 vnet_crypto_op_t *op;
462 vec_add2_aligned (ptd->crypto_ops, op, 1, CLIB_CACHE_LINE_BYTES);
463 vnet_crypto_op_init (op, sa0->crypto_enc_op_id);
464 op->src = op->dst = payload;
465 op->key_index = sa0->crypto_key_index;
466 op->len = payload_len - icv_sz;
467 op->user_data = b - bufs;
469 if (ipsec_sa_is_set_IS_AEAD (sa0))
472 * construct the AAD in a scratch space in front
475 op->aad = payload - hdr_len - sizeof (esp_aead_t);
477 esp_aad_fill (op, esp, sa0);
479 op->tag = payload + op->len;
482 u64 *iv = (u64 *) (payload - iv_sz);
483 nonce->salt = sa0->salt;
484 nonce->iv = *iv = clib_host_to_net_u64 (sa0->gcm_iv_counter++);
485 op->iv = (u8 *) nonce;
490 op->iv = payload - iv_sz;
491 op->flags = VNET_CRYPTO_OP_FLAG_INIT_IV;
495 if (sa0->integ_op_id)
497 vnet_crypto_op_t *op;
498 vec_add2_aligned (ptd->integ_ops, op, 1, CLIB_CACHE_LINE_BYTES);
499 vnet_crypto_op_init (op, sa0->integ_op_id);
500 op->src = payload - iv_sz - sizeof (esp_header_t);
501 op->digest = payload + payload_len - icv_sz;
502 op->key_index = sa0->integ_key_index;
503 op->digest_len = icv_sz;
504 op->len = payload_len - icv_sz + iv_sz + sizeof (esp_header_t);
505 op->user_data = b - bufs;
506 if (ipsec_sa_is_set_USE_ESN (sa0))
508 u32 seq_hi = clib_net_to_host_u32 (sa0->seq_hi);
509 clib_memcpy_fast (op->digest, &seq_hi, sizeof (seq_hi));
510 op->len += sizeof (seq_hi);
514 vlib_buffer_advance (b[0], 0LL - hdr_len);
516 current_sa_packets += 1;
517 current_sa_bytes += payload_len;
520 if (PREDICT_FALSE (b[0]->flags & VLIB_BUFFER_IS_TRACED))
522 esp_encrypt_trace_t *tr = vlib_add_trace (vm, node, b[0],
524 tr->sa_index = sa_index0;
527 tr->sa_seq_hi = sa0->seq_hi;
528 tr->udp_encap = ipsec_sa_is_set_UDP_ENCAP (sa0);
529 tr->crypto_alg = sa0->crypto_alg;
530 tr->integ_alg = sa0->integ_alg;
538 vlib_increment_combined_counter (&ipsec_sa_counters, thread_index,
539 current_sa_index, current_sa_packets,
541 esp_process_ops (vm, node, ptd->crypto_ops, bufs, nexts);
542 esp_process_ops (vm, node, ptd->integ_ops, bufs, nexts);
544 vlib_node_increment_counter (vm, node->node_index,
545 ESP_ENCRYPT_ERROR_RX_PKTS, frame->n_vectors);
547 vlib_buffer_enqueue_to_next (vm, node, from, nexts, frame->n_vectors);
548 return frame->n_vectors;
551 VLIB_NODE_FN (esp4_encrypt_node) (vlib_main_t * vm,
552 vlib_node_runtime_t * node,
553 vlib_frame_t * from_frame)
555 return esp_encrypt_inline (vm, node, from_frame, 0 /* is_ip6 */ , 0);
559 VLIB_REGISTER_NODE (esp4_encrypt_node) = {
560 .name = "esp4-encrypt",
561 .vector_size = sizeof (u32),
562 .format_trace = format_esp_encrypt_trace,
563 .type = VLIB_NODE_TYPE_INTERNAL,
565 .n_errors = ARRAY_LEN(esp_encrypt_error_strings),
566 .error_strings = esp_encrypt_error_strings,
568 .n_next_nodes = ESP_ENCRYPT_N_NEXT,
570 #define _(s,n) [ESP_ENCRYPT_NEXT_##s] = n,
571 foreach_esp_encrypt_next
577 VLIB_NODE_FN (esp6_encrypt_node) (vlib_main_t * vm,
578 vlib_node_runtime_t * node,
579 vlib_frame_t * from_frame)
581 return esp_encrypt_inline (vm, node, from_frame, 1 /* is_ip6 */ , 0);
585 VLIB_REGISTER_NODE (esp6_encrypt_node) = {
586 .name = "esp6-encrypt",
587 .vector_size = sizeof (u32),
588 .format_trace = format_esp_encrypt_trace,
589 .type = VLIB_NODE_TYPE_INTERNAL,
591 .n_errors = ARRAY_LEN(esp_encrypt_error_strings),
592 .error_strings = esp_encrypt_error_strings,
594 .n_next_nodes = ESP_ENCRYPT_N_NEXT,
596 #define _(s,n) [ESP_ENCRYPT_NEXT_##s] = n,
597 foreach_esp_encrypt_next
603 VLIB_NODE_FN (esp4_encrypt_tun_node) (vlib_main_t * vm,
604 vlib_node_runtime_t * node,
605 vlib_frame_t * from_frame)
607 return esp_encrypt_inline (vm, node, from_frame, 0 /* is_ip6 */ , 1);
611 VLIB_REGISTER_NODE (esp4_encrypt_tun_node) = {
612 .name = "esp4-encrypt-tun",
613 .vector_size = sizeof (u32),
614 .format_trace = format_esp_encrypt_trace,
615 .type = VLIB_NODE_TYPE_INTERNAL,
617 .n_errors = ARRAY_LEN(esp_encrypt_error_strings),
618 .error_strings = esp_encrypt_error_strings,
622 [ESP_ENCRYPT_NEXT_DROP] = "ip4-drop",
626 VNET_FEATURE_INIT (esp4_encrypt_tun_feat_node, static) =
628 .arc_name = "ip4-output",
629 .node_name = "esp4-encrypt-tun",
630 .runs_before = VNET_FEATURES ("adj-midchain-tx"),
633 VNET_FEATURE_INIT (esp6o4_encrypt_tun_feat_node, static) =
635 .arc_name = "ip6-output",
636 .node_name = "esp4-encrypt-tun",
637 .runs_before = VNET_FEATURES ("adj-midchain-tx"),
640 VNET_FEATURE_INIT (esp4_ethernet_encrypt_tun_feat_node, static) =
642 .arc_name = "ethernet-output",
643 .node_name = "esp4-encrypt-tun",
644 .runs_before = VNET_FEATURES ("adj-midchain-tx", "adj-midchain-tx-no-count"),
648 VLIB_NODE_FN (esp6_encrypt_tun_node) (vlib_main_t * vm,
649 vlib_node_runtime_t * node,
650 vlib_frame_t * from_frame)
652 return esp_encrypt_inline (vm, node, from_frame, 1 /* is_ip6 */ , 1);
656 VLIB_REGISTER_NODE (esp6_encrypt_tun_node) = {
657 .name = "esp6-encrypt-tun",
658 .vector_size = sizeof (u32),
659 .format_trace = format_esp_encrypt_trace,
660 .type = VLIB_NODE_TYPE_INTERNAL,
662 .n_errors = ARRAY_LEN(esp_encrypt_error_strings),
663 .error_strings = esp_encrypt_error_strings,
667 [ESP_ENCRYPT_NEXT_DROP] = "ip6-drop",
671 VNET_FEATURE_INIT (esp6_encrypt_tun_feat_node, static) =
673 .arc_name = "ip6-output",
674 .node_name = "esp6-encrypt-tun",
675 .runs_before = VNET_FEATURES ("adj-midchain-tx"),
678 VNET_FEATURE_INIT (esp4o6_encrypt_tun_feat_node, static) =
680 .arc_name = "ip4-output",
681 .node_name = "esp6-encrypt-tun",
682 .runs_before = VNET_FEATURES ("adj-midchain-tx"),
690 } esp_no_crypto_trace_t;
693 format_esp_no_crypto_trace (u8 * s, va_list * args)
695 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
696 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
697 esp_no_crypto_trace_t *t = va_arg (*args, esp_no_crypto_trace_t *);
699 s = format (s, "esp-no-crypto: sa-index %u", t->sa_index);
706 ESP_NO_CRYPTO_NEXT_DROP,
707 ESP_NO_CRYPTO_N_NEXT,
712 ESP_NO_CRYPTO_ERROR_RX_PKTS,
715 static char *esp_no_crypto_error_strings[] = {
716 "Outbound ESP packets received",
720 esp_no_crypto_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
721 vlib_frame_t * frame)
723 vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
724 u16 nexts[VLIB_FRAME_SIZE], *next = nexts;
725 u32 *from = vlib_frame_vector_args (frame);
726 u32 n_left = frame->n_vectors;
728 vlib_get_buffers (vm, from, b, n_left);
735 /* packets are always going to be dropped, but get the sa_index */
736 sa_index0 = *(u32 *) vnet_feature_next_with_data (&next0, b[0],
739 next[0] = ESP_NO_CRYPTO_NEXT_DROP;
741 if (PREDICT_FALSE (b[0]->flags & VLIB_BUFFER_IS_TRACED))
743 esp_no_crypto_trace_t *tr = vlib_add_trace (vm, node, b[0],
745 tr->sa_index = sa_index0;
753 vlib_node_increment_counter (vm, node->node_index,
754 ESP_NO_CRYPTO_ERROR_RX_PKTS, frame->n_vectors);
756 vlib_buffer_enqueue_to_next (vm, node, from, nexts, frame->n_vectors);
758 return frame->n_vectors;
761 VLIB_NODE_FN (esp4_no_crypto_tun_node) (vlib_main_t * vm,
762 vlib_node_runtime_t * node,
763 vlib_frame_t * from_frame)
765 return esp_no_crypto_inline (vm, node, from_frame);
769 VLIB_REGISTER_NODE (esp4_no_crypto_tun_node) =
771 .name = "esp4-no-crypto",
772 .vector_size = sizeof (u32),
773 .format_trace = format_esp_no_crypto_trace,
774 .n_errors = ARRAY_LEN(esp_no_crypto_error_strings),
775 .error_strings = esp_no_crypto_error_strings,
776 .n_next_nodes = ESP_NO_CRYPTO_N_NEXT,
778 [ESP_NO_CRYPTO_NEXT_DROP] = "ip4-drop",
782 VNET_FEATURE_INIT (esp4_no_crypto_tun_feat_node, static) =
784 .arc_name = "ip4-output",
785 .node_name = "esp4-no-crypto",
786 .runs_before = VNET_FEATURES ("adj-midchain-tx"),
789 VLIB_NODE_FN (esp6_no_crypto_tun_node) (vlib_main_t * vm,
790 vlib_node_runtime_t * node,
791 vlib_frame_t * from_frame)
793 return esp_no_crypto_inline (vm, node, from_frame);
797 VLIB_REGISTER_NODE (esp6_no_crypto_tun_node) =
799 .name = "esp6-no-crypto",
800 .vector_size = sizeof (u32),
801 .format_trace = format_esp_no_crypto_trace,
802 .n_errors = ARRAY_LEN(esp_no_crypto_error_strings),
803 .error_strings = esp_no_crypto_error_strings,
804 .n_next_nodes = ESP_NO_CRYPTO_N_NEXT,
806 [ESP_NO_CRYPTO_NEXT_DROP] = "ip6-drop",
810 VNET_FEATURE_INIT (esp6_no_crypto_tun_feat_node, static) =
812 .arc_name = "ip6-output",
813 .node_name = "esp6-no-crypto",
814 .runs_before = VNET_FEATURES ("adj-midchain-tx"),
819 * fd.io coding-style-patch-verification: ON
822 * eval: (c-set-style "gnu")