blob: a5e277ee09fac9f8b834ae9eab4251b19277c535 [file] [log] [blame]
“mukeshyadav1984”430ac932017-11-23 02:39:33 -08001/*
2 * ah_decrypt.c : IPSec AH decrypt node
3 *
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:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17
18#include <vnet/vnet.h>
19#include <vnet/api_errno.h>
20#include <vnet/ip/ip.h>
21
22#include <vnet/ipsec/ipsec.h>
23#include <vnet/ipsec/esp.h>
24#include <vnet/ipsec/ah.h>
Neale Ranns918c1612019-02-21 23:34:59 -080025#include <vnet/ipsec/ipsec_io.h>
“mukeshyadav1984”430ac932017-11-23 02:39:33 -080026
Neale Rannsf62a8c02019-04-02 08:13:33 +000027#define foreach_ah_decrypt_next \
28 _(DROP, "error-drop") \
29 _(IP4_INPUT, "ip4-input") \
30 _(IP6_INPUT, "ip6-input") \
31 _(HANDOFF, "handoff")
“mukeshyadav1984”430ac932017-11-23 02:39:33 -080032
33#define _(v, s) AH_DECRYPT_NEXT_##v,
34typedef enum
35{
36 foreach_ah_decrypt_next
37#undef _
38 AH_DECRYPT_N_NEXT,
39} ah_decrypt_next_t;
40
Klement Sekerabe5a5dd2018-10-09 16:05:48 +020041#define foreach_ah_decrypt_error \
42 _ (RX_PKTS, "AH pkts received") \
43 _ (DECRYPTION_FAILED, "AH decryption failed") \
44 _ (INTEG_ERROR, "Integrity check failed") \
Filip Tehlar6230eea2019-05-21 08:11:21 +000045 _ (NO_TAIL_SPACE, "not enough buffer tail space (dropped)") \
46 _ (DROP_FRAGMENTS, "IP fragments drop") \
Klement Sekerabe5a5dd2018-10-09 16:05:48 +020047 _ (REPLAY, "SA replayed packet")
“mukeshyadav1984”430ac932017-11-23 02:39:33 -080048
49typedef enum
50{
51#define _(sym,str) AH_DECRYPT_ERROR_##sym,
52 foreach_ah_decrypt_error
53#undef _
54 AH_DECRYPT_N_ERROR,
55} ah_decrypt_error_t;
56
57static char *ah_decrypt_error_strings[] = {
58#define _(sym,string) string,
59 foreach_ah_decrypt_error
60#undef _
61};
62
63typedef struct
64{
65 ipsec_integ_alg_t integ_alg;
Neale Rannsde847272018-11-28 01:38:34 -080066 u32 seq_num;
“mukeshyadav1984”430ac932017-11-23 02:39:33 -080067} ah_decrypt_trace_t;
68
69/* packet trace format function */
70static u8 *
71format_ah_decrypt_trace (u8 * s, va_list * args)
72{
73 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
74 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
75 ah_decrypt_trace_t *t = va_arg (*args, ah_decrypt_trace_t *);
76
Neale Rannsde847272018-11-28 01:38:34 -080077 s = format (s, "ah: integrity %U seq-num %d",
78 format_ipsec_integ_alg, t->integ_alg, t->seq_num);
“mukeshyadav1984”430ac932017-11-23 02:39:33 -080079 return s;
80}
81
Filip Tehlar6230eea2019-05-21 08:11:21 +000082typedef struct
83{
84 union
85 {
86 struct
87 {
88 u8 hop_limit;
89 u8 nexthdr;
90 u32 ip_version_traffic_class_and_flow_label;
91 };
92
93 struct
94 {
95 u8 ttl;
96 u8 tos;
97 };
98 };
99 u32 sa_index;
100 u32 seq;
101 u8 icv_padding_len;
102 u8 icv_size;
103 u8 ip_hdr_size;
104 i16 current_data;
105 u8 nexthdr_cached;
106} ah_decrypt_packet_data_t;
107
108static_always_inline void
109ah_process_ops (vlib_main_t * vm, vlib_node_runtime_t * node,
110 vnet_crypto_op_t * ops, vlib_buffer_t * b[], u16 * nexts)
111{
112 u32 n_fail, n_ops = vec_len (ops);
113 vnet_crypto_op_t *op = ops;
114
115 if (n_ops == 0)
116 return;
117
118 n_fail = n_ops - vnet_crypto_process_ops (vm, op, n_ops);
119
120 while (n_fail)
121 {
122 ASSERT (op - ops < n_ops);
123
124 if (op->status != VNET_CRYPTO_OP_STATUS_COMPLETED)
125 {
126 u32 bi = op->user_data;
127 b[bi]->error = node->errors[AH_DECRYPT_ERROR_INTEG_ERROR];
128 nexts[bi] = AH_DECRYPT_NEXT_DROP;
129 n_fail--;
130 }
131 op++;
132 }
133}
134
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200135always_inline uword
136ah_decrypt_inline (vlib_main_t * vm,
137 vlib_node_runtime_t * node, vlib_frame_t * from_frame,
138 int is_ip6)
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800139{
Filip Tehlar6230eea2019-05-21 08:11:21 +0000140 u32 n_left, *from;
141 u32 thread_index = vm->thread_index;
142 u16 buffer_data_size = vlib_buffer_get_default_data_size (vm);
143 ah_decrypt_packet_data_t pkt_data[VLIB_FRAME_SIZE], *pd = pkt_data;
144 vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
145 u16 nexts[VLIB_FRAME_SIZE], *next = nexts;
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800146 ipsec_main_t *im = &ipsec_main;
Filip Tehlar6230eea2019-05-21 08:11:21 +0000147 ipsec_per_thread_data_t *ptd = vec_elt_at_index (im->ptd, thread_index);
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800148 from = vlib_frame_vector_args (from_frame);
Filip Tehlar6230eea2019-05-21 08:11:21 +0000149 n_left = from_frame->n_vectors;
150 ipsec_sa_t *sa0 = 0;
151 u32 current_sa_index = ~0, current_sa_bytes = 0, current_sa_pkts = 0;
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800152
Filip Tehlar6230eea2019-05-21 08:11:21 +0000153 clib_memset (pkt_data, 0, VLIB_FRAME_SIZE * sizeof (pkt_data[0]));
154 vlib_get_buffers (vm, from, b, n_left);
155 clib_memset_u16 (nexts, -1, n_left);
156 vec_reset_length (ptd->integ_ops);
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800157
Filip Tehlar6230eea2019-05-21 08:11:21 +0000158 while (n_left > 0)
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800159 {
Filip Tehlar6230eea2019-05-21 08:11:21 +0000160 ah_header_t *ah0;
161 ip4_header_t *ih4;
162 ip6_header_t *ih6;
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800163
Filip Tehlar6230eea2019-05-21 08:11:21 +0000164 if (vnet_buffer (b[0])->ipsec.sad_index != current_sa_index)
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800165 {
Filip Tehlar6230eea2019-05-21 08:11:21 +0000166 if (current_sa_index != ~0)
167 vlib_increment_combined_counter (&ipsec_sa_counters, thread_index,
168 current_sa_index,
169 current_sa_pkts,
170 current_sa_bytes);
171 current_sa_index = vnet_buffer (b[0])->ipsec.sad_index;
172 sa0 = pool_elt_at_index (im->sad, current_sa_index);
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800173
Filip Tehlar6230eea2019-05-21 08:11:21 +0000174 current_sa_bytes = current_sa_pkts = 0;
Neale Rannseba31ec2019-02-17 18:04:27 +0000175 vlib_prefetch_combined_counter (&ipsec_sa_counters,
Filip Tehlar6230eea2019-05-21 08:11:21 +0000176 thread_index, current_sa_index);
177 }
178
Neale Ranns1a52d372021-02-04 11:33:32 +0000179 if (PREDICT_FALSE (~0 == sa0->thread_index))
Neale Rannsf62a8c02019-04-02 08:13:33 +0000180 {
181 /* this is the first packet to use this SA, claim the SA
182 * for this thread. this could happen simultaneously on
183 * another thread */
Neale Ranns1a52d372021-02-04 11:33:32 +0000184 clib_atomic_cmp_and_swap (&sa0->thread_index, ~0,
Neale Rannsf62a8c02019-04-02 08:13:33 +0000185 ipsec_sa_assign_thread (thread_index));
186 }
187
Neale Ranns1a52d372021-02-04 11:33:32 +0000188 if (PREDICT_TRUE (thread_index != sa0->thread_index))
Neale Rannsf62a8c02019-04-02 08:13:33 +0000189 {
Neale Rannsaa7d7662021-02-10 08:42:49 +0000190 vnet_buffer (b[0])->ipsec.thread_index = sa0->thread_index;
Neale Rannsf62a8c02019-04-02 08:13:33 +0000191 next[0] = AH_DECRYPT_NEXT_HANDOFF;
192 goto next;
193 }
194
Filip Tehlar6230eea2019-05-21 08:11:21 +0000195 pd->sa_index = current_sa_index;
196
197 ih4 = vlib_buffer_get_current (b[0]);
198 ih6 = vlib_buffer_get_current (b[0]);
199 pd->current_data = b[0]->current_data;
200
201 if (is_ip6)
202 {
203 ip6_ext_header_t *prev = NULL;
Klement Sekera769145c2019-03-06 11:59:57 +0100204 ah0 =
205 ip6_ext_header_find (vm, b[0], ih6, IP_PROTOCOL_IPSEC_AH, &prev);
Filip Tehlar6230eea2019-05-21 08:11:21 +0000206 pd->ip_hdr_size = sizeof (ip6_header_t);
207 ASSERT ((u8 *) ah0 - (u8 *) ih6 == pd->ip_hdr_size);
208 }
209 else
210 {
211 if (ip4_is_fragment (ih4))
212 {
213 b[0]->error = node->errors[AH_DECRYPT_ERROR_DROP_FRAGMENTS];
214 next[0] = AH_DECRYPT_NEXT_DROP;
215 goto next;
216 }
217 pd->ip_hdr_size = ip4_header_bytes (ih4);
218 ah0 = (ah_header_t *) ((u8 *) ih4 + pd->ip_hdr_size);
219 }
220
221 pd->seq = clib_host_to_net_u32 (ah0->seq_no);
222
223 /* anti-replay check */
Neale Ranns6afaae12019-07-17 15:07:14 +0000224 if (ipsec_sa_anti_replay_check (sa0, pd->seq))
Filip Tehlar6230eea2019-05-21 08:11:21 +0000225 {
226 b[0]->error = node->errors[AH_DECRYPT_ERROR_REPLAY];
227 next[0] = AH_DECRYPT_NEXT_DROP;
228 goto next;
229 }
230
231 current_sa_bytes += b[0]->current_length;
232 current_sa_pkts += 1;
233
234 pd->icv_size = sa0->integ_icv_size;
235 pd->nexthdr_cached = ah0->nexthdr;
236 if (PREDICT_TRUE (sa0->integ_alg != IPSEC_INTEG_ALG_NONE))
237 {
238 if (PREDICT_FALSE (ipsec_sa_is_set_USE_ESN (sa0) &&
239 pd->current_data + b[0]->current_length
240 + sizeof (u32) > buffer_data_size))
241 {
242 b[0]->error = node->errors[AH_DECRYPT_ERROR_NO_TAIL_SPACE];
243 next[0] = AH_DECRYPT_NEXT_DROP;
244 goto next;
245 }
246
247 vnet_crypto_op_t *op;
248 vec_add2_aligned (ptd->integ_ops, op, 1, CLIB_CACHE_LINE_BYTES);
249 vnet_crypto_op_init (op, sa0->integ_op_id);
250
251 op->src = (u8 *) ih4;
252 op->len = b[0]->current_length;
253 op->digest = (u8 *) ih4 - pd->icv_size;
254 op->flags = VNET_CRYPTO_OP_FLAG_HMAC_CHECK;
255 op->digest_len = pd->icv_size;
256 op->key_index = sa0->integ_key_index;
257 op->user_data = b - bufs;
258 if (ipsec_sa_is_set_USE_ESN (sa0))
259 {
260 u32 seq_hi = clib_host_to_net_u32 (sa0->seq_hi);
261
262 op->len += sizeof (seq_hi);
263 clib_memcpy (op->src + b[0]->current_length, &seq_hi,
264 sizeof (seq_hi));
265 }
266 clib_memcpy (op->digest, ah0->auth_data, pd->icv_size);
267 clib_memset (ah0->auth_data, 0, pd->icv_size);
Neale Rannseba31ec2019-02-17 18:04:27 +0000268
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200269 if (is_ip6)
Klement Sekera611864f2018-09-26 11:19:00 +0200270 {
Filip Tehlar6230eea2019-05-21 08:11:21 +0000271 pd->ip_version_traffic_class_and_flow_label =
272 ih6->ip_version_traffic_class_and_flow_label;
273 pd->hop_limit = ih6->hop_limit;
274 ih6->ip_version_traffic_class_and_flow_label = 0x60;
275 ih6->hop_limit = 0;
276 pd->nexthdr = ah0->nexthdr;
277 pd->icv_padding_len =
278 ah_calc_icv_padding_len (pd->icv_size, 1 /* is_ipv6 */ );
Klement Sekera611864f2018-09-26 11:19:00 +0200279 }
280 else
281 {
Filip Tehlar6230eea2019-05-21 08:11:21 +0000282 pd->tos = ih4->tos;
283 pd->ttl = ih4->ttl;
284 ih4->tos = 0;
285 ih4->ttl = 0;
286 ih4->checksum = 0;
287 pd->icv_padding_len =
288 ah_calc_icv_padding_len (pd->icv_size, 0 /* is_ipv6 */ );
Klement Sekera611864f2018-09-26 11:19:00 +0200289 }
Filip Tehlar6230eea2019-05-21 08:11:21 +0000290 }
Klement Sekera611864f2018-09-26 11:19:00 +0200291
Filip Tehlar6230eea2019-05-21 08:11:21 +0000292 next:
293 n_left -= 1;
294 pd += 1;
295 next += 1;
296 b += 1;
297 }
Neale Rannsde847272018-11-28 01:38:34 -0800298
Filip Tehlar6230eea2019-05-21 08:11:21 +0000299 n_left = from_frame->n_vectors;
300 next = nexts;
301 pd = pkt_data;
302 b = bufs;
303
304 vlib_node_increment_counter (vm, node->node_index, AH_DECRYPT_ERROR_RX_PKTS,
305 n_left);
306 vlib_increment_combined_counter (&ipsec_sa_counters, thread_index,
307 current_sa_index, current_sa_pkts,
308 current_sa_bytes);
309
310 ah_process_ops (vm, node, ptd->integ_ops, bufs, nexts);
311
312 while (n_left > 0)
313 {
314 ip4_header_t *oh4;
315 ip6_header_t *oh6;
316
317 if (next[0] < AH_DECRYPT_N_NEXT)
318 goto trace;
319
320 sa0 = vec_elt_at_index (im->sad, pd->sa_index);
321
322 if (PREDICT_TRUE (sa0->integ_alg != IPSEC_INTEG_ALG_NONE))
323 {
Neale Ranns3b9374f2019-08-01 04:45:15 -0700324 /* redo the anit-reply check. see esp_decrypt for details */
325 if (ipsec_sa_anti_replay_check (sa0, pd->seq))
326 {
327 b[0]->error = node->errors[AH_DECRYPT_ERROR_REPLAY];
328 next[0] = AH_DECRYPT_NEXT_DROP;
329 goto trace;
330 }
Neale Ranns6afaae12019-07-17 15:07:14 +0000331 ipsec_sa_anti_replay_advance (sa0, pd->seq);
Filip Tehlar6230eea2019-05-21 08:11:21 +0000332 }
333
334 u16 ah_hdr_len = sizeof (ah_header_t) + pd->icv_size
335 + pd->icv_padding_len;
336 vlib_buffer_advance (b[0], pd->ip_hdr_size + ah_hdr_len);
337 b[0]->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
338
339 if (PREDICT_TRUE (ipsec_sa_is_set_IS_TUNNEL (sa0)))
340 { /* tunnel mode */
341 if (PREDICT_TRUE (pd->nexthdr_cached == IP_PROTOCOL_IP_IN_IP))
342 next[0] = AH_DECRYPT_NEXT_IP4_INPUT;
343 else if (pd->nexthdr_cached == IP_PROTOCOL_IPV6)
344 next[0] = AH_DECRYPT_NEXT_IP6_INPUT;
345 else
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800346 {
Filip Tehlar6230eea2019-05-21 08:11:21 +0000347 b[0]->error = node->errors[AH_DECRYPT_ERROR_DECRYPTION_FAILED];
348 next[0] = AH_DECRYPT_NEXT_DROP;
Damjan Marion1f4e1cb2019-03-28 19:19:31 +0100349 goto trace;
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800350 }
Filip Tehlar6230eea2019-05-21 08:11:21 +0000351 }
352 else
353 { /* transport mode */
354 if (is_ip6)
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800355 {
Filip Tehlar6230eea2019-05-21 08:11:21 +0000356 vlib_buffer_advance (b[0], -sizeof (ip6_header_t));
357 oh6 = vlib_buffer_get_current (b[0]);
358 if (ah_hdr_len >= sizeof (ip6_header_t))
359 clib_memcpy (oh6, b[0]->data + pd->current_data,
360 sizeof (ip6_header_t));
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200361 else
Filip Tehlar6230eea2019-05-21 08:11:21 +0000362 memmove (oh6, b[0]->data + pd->current_data,
363 sizeof (ip6_header_t));
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800364
Filip Tehlar6230eea2019-05-21 08:11:21 +0000365 next[0] = AH_DECRYPT_NEXT_IP6_INPUT;
366 oh6->protocol = pd->nexthdr;
367 oh6->hop_limit = pd->hop_limit;
368 oh6->ip_version_traffic_class_and_flow_label =
369 pd->ip_version_traffic_class_and_flow_label;
370 oh6->payload_length =
371 clib_host_to_net_u16 (vlib_buffer_length_in_chain
372 (vm, b[0]) - sizeof (ip6_header_t));
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800373 }
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800374 else
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800375 {
Filip Tehlar6230eea2019-05-21 08:11:21 +0000376 vlib_buffer_advance (b[0], -sizeof (ip4_header_t));
377 oh4 = vlib_buffer_get_current (b[0]);
378 if (ah_hdr_len >= sizeof (ip4_header_t))
379 clib_memcpy (oh4, b[0]->data + pd->current_data,
380 sizeof (ip4_header_t));
381 else
382 memmove (oh4, b[0]->data + pd->current_data,
383 sizeof (ip4_header_t));
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800384
Filip Tehlar6230eea2019-05-21 08:11:21 +0000385 next[0] = AH_DECRYPT_NEXT_IP4_INPUT;
386 oh4->ip_version_and_header_length = 0x45;
387 oh4->fragment_id = 0;
388 oh4->flags_and_fragment_offset = 0;
389 oh4->protocol = pd->nexthdr_cached;
390 oh4->length =
391 clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b[0]));
392 oh4->ttl = pd->ttl;
393 oh4->tos = pd->tos;
394 oh4->checksum = ip4_header_checksum (oh4);
395 }
396 }
397
Filip Tehlar6230eea2019-05-21 08:11:21 +0000398 vnet_buffer (b[0])->sw_if_index[VLIB_TX] = (u32) ~ 0;
399 trace:
400 if (PREDICT_FALSE (b[0]->flags & VLIB_BUFFER_IS_TRACED))
401 {
402 sa0 = pool_elt_at_index (im->sad,
403 vnet_buffer (b[0])->ipsec.sad_index);
404 ah_decrypt_trace_t *tr =
405 vlib_add_trace (vm, node, b[0], sizeof (*tr));
406 tr->integ_alg = sa0->integ_alg;
407 tr->seq_num = pd->seq;
408 }
409
410 n_left -= 1;
411 pd += 1;
412 next += 1;
413 b += 1;
414 }
415
416 n_left = from_frame->n_vectors;
417 vlib_buffer_enqueue_to_next (vm, node, from, nexts, n_left);
418
419 return n_left;
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800420}
421
Klement Sekerab8f35442018-10-29 13:38:19 +0100422VLIB_NODE_FN (ah4_decrypt_node) (vlib_main_t * vm,
423 vlib_node_runtime_t * node,
424 vlib_frame_t * from_frame)
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200425{
426 return ah_decrypt_inline (vm, node, from_frame, 0 /* is_ip6 */ );
427}
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800428
429/* *INDENT-OFF* */
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200430VLIB_REGISTER_NODE (ah4_decrypt_node) = {
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200431 .name = "ah4-decrypt",
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800432 .vector_size = sizeof (u32),
433 .format_trace = format_ah_decrypt_trace,
434 .type = VLIB_NODE_TYPE_INTERNAL,
435
436 .n_errors = ARRAY_LEN(ah_decrypt_error_strings),
437 .error_strings = ah_decrypt_error_strings,
438
439 .n_next_nodes = AH_DECRYPT_N_NEXT,
440 .next_nodes = {
Neale Rannsf62a8c02019-04-02 08:13:33 +0000441 [AH_DECRYPT_NEXT_DROP] = "ip4-drop",
442 [AH_DECRYPT_NEXT_IP4_INPUT] = "ip4-input-no-checksum",
443 [AH_DECRYPT_NEXT_IP6_INPUT] = "ip6-input",
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000444 [AH_DECRYPT_NEXT_HANDOFF] = "ah4-decrypt-handoff",
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800445 },
446};
447/* *INDENT-ON* */
448
Klement Sekerab8f35442018-10-29 13:38:19 +0100449VLIB_NODE_FN (ah6_decrypt_node) (vlib_main_t * vm,
450 vlib_node_runtime_t * node,
451 vlib_frame_t * from_frame)
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200452{
453 return ah_decrypt_inline (vm, node, from_frame, 1 /* is_ip6 */ );
454}
455
456/* *INDENT-OFF* */
457VLIB_REGISTER_NODE (ah6_decrypt_node) = {
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200458 .name = "ah6-decrypt",
459 .vector_size = sizeof (u32),
460 .format_trace = format_ah_decrypt_trace,
461 .type = VLIB_NODE_TYPE_INTERNAL,
462
463 .n_errors = ARRAY_LEN(ah_decrypt_error_strings),
464 .error_strings = ah_decrypt_error_strings,
465
466 .n_next_nodes = AH_DECRYPT_N_NEXT,
467 .next_nodes = {
Neale Rannsf62a8c02019-04-02 08:13:33 +0000468 [AH_DECRYPT_NEXT_DROP] = "ip6-drop",
469 [AH_DECRYPT_NEXT_IP4_INPUT] = "ip4-input-no-checksum",
470 [AH_DECRYPT_NEXT_IP6_INPUT] = "ip6-input",
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000471 [AH_DECRYPT_NEXT_HANDOFF] = "ah6-decrypt-handoff",
Klement Sekerabe5a5dd2018-10-09 16:05:48 +0200472 },
473};
474/* *INDENT-ON* */
475
Neale Ranns2d498302021-02-25 08:38:58 +0000476#ifndef CLIB_MARCH_VARIANT
477
478static clib_error_t *
479ah_decrypt_init (vlib_main_t *vm)
480{
481 ipsec_main_t *im = &ipsec_main;
482
483 im->ah4_dec_fq_index =
484 vlib_frame_queue_main_init (ah4_decrypt_node.index, 0);
485 im->ah6_dec_fq_index =
486 vlib_frame_queue_main_init (ah6_decrypt_node.index, 0);
487
488 return 0;
489}
490
491VLIB_INIT_FUNCTION (ah_decrypt_init);
492
493#endif
494
“mukeshyadav1984”430ac932017-11-23 02:39:33 -0800495/*
496 * fd.io coding-style-patch-verification: ON
497 *
498 * Local Variables:
499 * eval: (c-set-style "gnu")
500 * End:
501 */