FD.io VPP  v21.06
Vector Packet Processing
ah_decrypt.c
Go to the documentation of this file.
1 /*
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>
25 #include <vnet/ipsec/ipsec_io.h>
26 
27 #define foreach_ah_decrypt_next \
28  _(DROP, "error-drop") \
29  _(IP4_INPUT, "ip4-input") \
30  _(IP6_INPUT, "ip6-input") \
31  _(HANDOFF, "handoff")
32 
33 #define _(v, s) AH_DECRYPT_NEXT_##v,
34 typedef enum
35 {
37 #undef _
40 
41 #define foreach_ah_decrypt_error \
42  _ (RX_PKTS, "AH pkts received") \
43  _ (DECRYPTION_FAILED, "AH decryption failed") \
44  _ (INTEG_ERROR, "Integrity check failed") \
45  _ (NO_TAIL_SPACE, "not enough buffer tail space (dropped)") \
46  _ (DROP_FRAGMENTS, "IP fragments drop") \
47  _ (REPLAY, "SA replayed packet")
48 
49 typedef enum
50 {
51 #define _(sym,str) AH_DECRYPT_ERROR_##sym,
53 #undef _
56 
57 static char *ah_decrypt_error_strings[] = {
58 #define _(sym,string) string,
60 #undef _
61 };
62 
63 typedef struct
64 {
65  ipsec_integ_alg_t integ_alg;
68 
69 /* packet trace format function */
70 static u8 *
71 format_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 
77  s = format (s, "ah: integrity %U seq-num %d",
79  return s;
80 }
81 
82 typedef struct
83 {
84  union
85  {
86  struct
87  {
91  };
92 
93  struct
94  {
97  };
98  };
107 
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 
138  int is_ip6)
139 {
140  u32 n_left, *from;
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;
147  ipsec_per_thread_data_t *ptd = vec_elt_at_index (im->ptd, thread_index);
148  from = vlib_frame_vector_args (from_frame);
149  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;
152 
153  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);
157 
158  while (n_left > 0)
159  {
160  ah_header_t *ah0;
161  ip4_header_t *ih4;
162  ip6_header_t *ih6;
163 
164  if (vnet_buffer (b[0])->ipsec.sad_index != current_sa_index)
165  {
166  if (current_sa_index != ~0)
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 = ipsec_sa_get (current_sa_index);
173 
174  current_sa_bytes = current_sa_pkts = 0;
176  thread_index, current_sa_index);
177  }
178 
179  if (PREDICT_FALSE (~0 == sa0->thread_index))
180  {
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 */
185  ipsec_sa_assign_thread (thread_index));
186  }
187 
188  if (PREDICT_TRUE (thread_index != sa0->thread_index))
189  {
190  vnet_buffer (b[0])->ipsec.thread_index = sa0->thread_index;
191  next[0] = AH_DECRYPT_NEXT_HANDOFF;
192  goto next;
193  }
194 
195  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;
204  ah0 =
205  ip6_ext_header_find (vm, b[0], ih6, IP_PROTOCOL_IPSEC_AH, &prev);
206  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 */
224  if (ipsec_sa_anti_replay_check (sa0, pd->seq))
225  {
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;
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;
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);
268 
269  if (is_ip6)
270  {
273  pd->hop_limit = ih6->hop_limit;
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 */ );
279  }
280  else
281  {
282  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 */ );
289  }
290  }
291 
292  next:
293  n_left -= 1;
294  pd += 1;
295  next += 1;
296  b += 1;
297  }
298 
299  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);
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 = ipsec_sa_get (pd->sa_index);
321 
322  if (PREDICT_TRUE (sa0->integ_alg != IPSEC_INTEG_ALG_NONE))
323  {
324  /* 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  }
332  }
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
346  {
347  b[0]->error = node->errors[AH_DECRYPT_ERROR_DECRYPTION_FAILED];
348  next[0] = AH_DECRYPT_NEXT_DROP;
349  goto trace;
350  }
351  }
352  else
353  { /* transport mode */
354  if (is_ip6)
355  {
356  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));
361  else
362  memmove (oh6, b[0]->data + pd->current_data,
363  sizeof (ip6_header_t));
364 
365  next[0] = AH_DECRYPT_NEXT_IP6_INPUT;
366  oh6->protocol = pd->nexthdr;
367  oh6->hop_limit = pd->hop_limit;
370  oh6->payload_length =
371  clib_host_to_net_u16 (vlib_buffer_length_in_chain
372  (vm, b[0]) - sizeof (ip6_header_t));
373  }
374  else
375  {
376  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));
384 
385  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 
398  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 = ipsec_sa_get (vnet_buffer (b[0])->ipsec.sad_index);
403  ah_decrypt_trace_t *tr =
404  vlib_add_trace (vm, node, b[0], sizeof (*tr));
405  tr->integ_alg = sa0->integ_alg;
406  tr->seq_num = pd->seq;
407  }
408 
409  n_left -= 1;
410  pd += 1;
411  next += 1;
412  b += 1;
413  }
414 
415  n_left = from_frame->n_vectors;
416  vlib_buffer_enqueue_to_next (vm, node, from, nexts, n_left);
417 
418  return n_left;
419 }
420 
424 {
425  return ah_decrypt_inline (vm, node, from_frame, 0 /* is_ip6 */ );
426 }
427 
428 /* *INDENT-OFF* */
430  .name = "ah4-decrypt",
431  .vector_size = sizeof (u32),
432  .format_trace = format_ah_decrypt_trace,
434 
435  .n_errors = ARRAY_LEN(ah_decrypt_error_strings),
436  .error_strings = ah_decrypt_error_strings,
437 
438  .n_next_nodes = AH_DECRYPT_N_NEXT,
439  .next_nodes = {
440  [AH_DECRYPT_NEXT_DROP] = "ip4-drop",
441  [AH_DECRYPT_NEXT_IP4_INPUT] = "ip4-input-no-checksum",
442  [AH_DECRYPT_NEXT_IP6_INPUT] = "ip6-input",
443  [AH_DECRYPT_NEXT_HANDOFF] = "ah4-decrypt-handoff",
444  },
445 };
446 /* *INDENT-ON* */
447 
451 {
452  return ah_decrypt_inline (vm, node, from_frame, 1 /* is_ip6 */ );
453 }
454 
455 /* *INDENT-OFF* */
457  .name = "ah6-decrypt",
458  .vector_size = sizeof (u32),
459  .format_trace = format_ah_decrypt_trace,
461 
462  .n_errors = ARRAY_LEN(ah_decrypt_error_strings),
463  .error_strings = ah_decrypt_error_strings,
464 
465  .n_next_nodes = AH_DECRYPT_N_NEXT,
466  .next_nodes = {
467  [AH_DECRYPT_NEXT_DROP] = "ip6-drop",
468  [AH_DECRYPT_NEXT_IP4_INPUT] = "ip4-input-no-checksum",
469  [AH_DECRYPT_NEXT_IP6_INPUT] = "ip6-input",
470  [AH_DECRYPT_NEXT_HANDOFF] = "ah6-decrypt-handoff",
471  },
472 };
473 /* *INDENT-ON* */
474 
475 #ifndef CLIB_MARCH_VARIANT
476 
477 static clib_error_t *
479 {
481 
482  im->ah4_dec_fq_index =
484  im->ah6_dec_fq_index =
486 
487  return 0;
488 }
489 
491 
492 #endif
493 
494 /*
495  * fd.io coding-style-patch-verification: ON
496  *
497  * Local Variables:
498  * eval: (c-set-style "gnu")
499  * End:
500  */
u32 vnet_crypto_process_ops(vlib_main_t *vm, vnet_crypto_op_t ops[], u32 n_ops)
Definition: crypto.c:99
static char * ah_decrypt_error_strings[]
Definition: ah_decrypt.c:57
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:133
u8 * format_ipsec_integ_alg(u8 *s, va_list *args)
Definition: ipsec_format.c:111
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
Definition: vlib_api_cli.c:899
#define CLIB_UNUSED(x)
Definition: clib.h:90
ipsec_per_thread_data_t * ptd
Definition: ipsec.h:191
vnet_crypto_op_t * integ_ops
Definition: ipsec.h:101
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
Definition: esp_encrypt.c:1328
u32 thread_index
#define PREDICT_TRUE(x)
Definition: clib.h:125
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Definition: buffer.h:119
u16 nexts[VLIB_FRAME_SIZE]
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u32 ipsec_sa_assign_thread(u32 thread_id)
Definition: ipsec_sa.h:512
#define vec_add2_aligned(V, P, N, A)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:657
u32 vlib_frame_queue_main_init(u32 node_index, u32 frame_queue_nelts)
Definition: threads.c:1572
ipsec_integ_alg_t integ_alg
Definition: ipsec_sa.h:218
u32 thread_index
Definition: main.h:213
u16 current_length
Nbytes between current data and the end of this buffer.
Definition: buffer.h:122
static uword ah_decrypt_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int is_ip6)
Definition: ah_decrypt.c:136
u16 flags_and_fragment_offset
Definition: ip4_packet.h:106
#define VLIB_NODE_FN(node)
Definition: node.h:202
vlib_error_t * errors
Vector of errors for this node.
Definition: node.h:461
vnet_crypto_op_id_t integ_op_id
Definition: ipsec_sa.h:150
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:433
ah_decrypt_error_t
Definition: ah_decrypt.c:49
unsigned char u8
Definition: types.h:56
vlib_buffer_t ** b
u8 data[128]
Definition: ipsec_types.api:92
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static int ip4_is_fragment(const ip4_header_t *i)
Definition: ip4_packet.h:168
u32 seq_hi
Definition: ipsec_sa.h:133
unsigned int u32
Definition: types.h:88
#define clib_memcpy(d, s, n)
Definition: string.h:197
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
vlib_node_registration_t ah6_decrypt_node
(constructor) VLIB_REGISTER_NODE (ah6_decrypt_node)
Definition: ah_decrypt.c:456
#define static_always_inline
Definition: clib.h:112
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
vlib_get_buffers(vm, from, b, n_left_from)
unsigned int seq_no
Definition: ah.h:27
u32 ip_version_traffic_class_and_flow_label
Definition: ah_decrypt.c:90
description fragment has unexpected format
Definition: map.api:433
static_always_inline void vnet_crypto_op_init(vnet_crypto_op_t *op, vnet_crypto_op_id_t type)
Definition: crypto.h:528
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u32 ah6_dec_fq_index
Definition: ipsec.h:197
static u8 * format_ah_decrypt_trace(u8 *s, va_list *args)
Definition: ah_decrypt.c:71
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
unsigned char auth_data[0]
Definition: ah.h:28
#define VLIB_FRAME_SIZE
Definition: node.h:369
bool is_ip6
Definition: ip.api:43
static void * ip6_ext_header_find(vlib_main_t *vm, vlib_buffer_t *b, ip6_header_t *ip6_header, u8 header_type, ip6_ext_header_t **prev_ext_header)
Definition: ip6_packet.h:575
static u8 ah_calc_icv_padding_len(u8 icv_size, int is_ipv6)
Definition: ah.h:47
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:145
#define foreach_ah_decrypt_error
Definition: ah_decrypt.c:41
u16 * next
uword user_data
Definition: crypto.h:258
static void ipsec_sa_anti_replay_advance(ipsec_sa_t *sa, u32 seq)
Definition: ipsec_sa.h:447
unsigned short u16
Definition: types.h:57
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:257
#define PREDICT_FALSE(x)
Definition: clib.h:124
static void vlib_prefetch_combined_counter(const vlib_combined_counter_main_t *cm, u32 thread_index, u32 index)
Pre-fetch a per-thread combined counter for the given object index.
Definition: counter.h:248
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
unsigned char nexthdr
Definition: ah.h:23
u32 node_index
Node index.
Definition: node.h:479
u32 ah4_dec_fq_index
Definition: ipsec.h:195
u32 n_left
#define VNET_CRYPTO_OP_FLAG_HMAC_CHECK
Definition: crypto.h:263
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1244
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
Definition: buffer_funcs.h:122
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
u16 n_vectors
Definition: node.h:388
vlib_node_registration_t ah4_decrypt_node
(constructor) VLIB_REGISTER_NODE (ah4_decrypt_node)
Definition: ah_decrypt.c:429
vnet_interface_main_t * im
u32 thread_index
Definition: ipsec_sa.h:129
#define ARRAY_LEN(x)
Definition: clib.h:70
static_always_inline void ah_process_ops(vlib_main_t *vm, vlib_node_runtime_t *node, vnet_crypto_op_t *ops, vlib_buffer_t *b[], u16 *nexts)
Definition: ah_decrypt.c:109
#define foreach_ah_decrypt_next
Definition: ah_decrypt.c:27
#define clib_atomic_cmp_and_swap(addr, old, new)
Definition: atomics.h:37
vlib_combined_counter_main_t ipsec_sa_counters
SA packet & bytes counters.
Definition: ipsec_sa.c:27
#define ASSERT(truth)
ip_dscp_t tos
Definition: ip4_packet.h:96
#define always_inline
Definition: rdma_mlx5dv.h:23
static int ipsec_sa_anti_replay_check(ipsec_sa_t *sa, u32 seq)
Definition: ipsec_sa.h:320
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:276
vnet_crypto_key_index_t integ_key_index
Definition: ipsec_sa.h:140
static_always_inline void clib_memset_u16(void *p, u16 val, uword count)
Definition: string.h:395
u32 ip_version_traffic_class_and_flow_label
Definition: ip6_packet.h:297
Definition: defs.h:47
u16 payload_length
Definition: ip6_packet.h:301
static ipsec_sa_t * ipsec_sa_get(u32 sa_index)
Definition: ipsec_sa.h:519
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
ipsec_main_t ipsec_main
Definition: ipsec.c:28
ah_decrypt_next_t
Definition: ah_decrypt.c:34
VLIB buffer representation.
Definition: buffer.h:111
u64 uword
Definition: types.h:112
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:301
static clib_error_t * ah_decrypt_init(vlib_main_t *vm)
Definition: ah_decrypt.c:478
vnet_crypto_op_status_t status
Definition: crypto.h:260
#define vnet_buffer(b)
Definition: buffer.h:437
Definition: ah.h:21
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:628
static int ip4_header_bytes(const ip4_header_t *i)
Definition: ip4_packet.h:190
u8 ip_version_and_header_length
Definition: ip4_packet.h:93
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
ipsec_integ_alg_t integ_alg
Definition: ah_decrypt.c:65
u8 integ_icv_size
Definition: ipsec_sa.h:125
static u16 ip4_header_checksum(ip4_header_t *i)
Definition: ip4_packet.h:314
signed short i16
Definition: types.h:46