FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ipsec_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * ipsec_api.c - ipsec api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/vnet.h>
21 #include <vlibmemory/api.h>
22 
23 #include <vnet/interface.h>
24 #include <vnet/api_errno.h>
25 #include <vnet/ip/ip.h>
26 #include <vnet/ip/ip_types_api.h>
29 #include <vnet/fib/fib.h>
30 #include <vnet/ipip/ipip.h>
32 #include <vnet/ipsec/ipsec.h>
33 #include <vnet/ipsec/ipsec_tun.h>
34 #include <vnet/ipsec/ipsec_itf.h>
35 
36 #include <vnet/format_fns.h>
37 #include <vnet/ipsec/ipsec.api_enum.h>
38 #include <vnet/ipsec/ipsec.api_types.h>
39 
40 #define REPLY_MSG_ID_BASE ipsec_main.msg_id_base
42 
43 static void
45 {
46  vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
47  vl_api_ipsec_spd_add_del_reply_t *rmp;
48  int rv;
49 
50  rv = ipsec_add_del_spd (vm, ntohl (mp->spd_id), mp->is_add);
51 
52  REPLY_MACRO (VL_API_IPSEC_SPD_ADD_DEL_REPLY);
53 }
54 
57 {
58  vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
59  vl_api_ipsec_interface_add_del_spd_reply_t *rmp;
60  int rv;
61  u32 sw_if_index __attribute__ ((unused));
62  u32 spd_id __attribute__ ((unused));
63 
64  sw_if_index = ntohl (mp->sw_if_index);
65  spd_id = ntohl (mp->spd_id);
66 
68 
70 
72 
73  REPLY_MACRO (VL_API_IPSEC_INTERFACE_ADD_DEL_SPD_REPLY);
74 }
75 
78 {
79  vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
80  vl_api_ipsec_tunnel_protect_update_reply_t *rmp;
81  u32 sw_if_index, ii, *sa_ins = NULL;
83  int rv;
84 
85  sw_if_index = ntohl (mp->tunnel.sw_if_index);
86 
88 
89  for (ii = 0; ii < mp->tunnel.n_sa_in; ii++)
90  vec_add1 (sa_ins, ntohl (mp->tunnel.sa_in[ii]));
91 
92  ip_address_decode2 (&mp->tunnel.nh, &nh);
93 
95  ntohl (mp->tunnel.sa_out), sa_ins);
96 
98 
99  REPLY_MACRO (VL_API_IPSEC_TUNNEL_PROTECT_UPDATE_REPLY);
100 }
101 
104 {
105  vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
106  vl_api_ipsec_tunnel_protect_del_reply_t *rmp;
109  int rv;
110 
111  sw_if_index = ntohl (mp->sw_if_index);
112 
114 
115  ip_address_decode2 (&mp->nh, &nh);
117 
119 
120  REPLY_MACRO (VL_API_IPSEC_TUNNEL_PROTECT_DEL_REPLY);
121 }
122 
124 {
128 
129 static walk_rc_t
131 {
132  ipsec_dump_walk_ctx_t *ctx = arg;
134  ipsec_tun_protect_t *itp;
135  u32 ii = 0;
136  ipsec_sa_t *sa;
137 
138  itp = ipsec_tun_protect_get (itpi);
139 
140  mp = vl_msg_api_alloc (sizeof (*mp) + (sizeof (u32) * itp->itp_n_sa_in));
141  clib_memset (mp, 0, sizeof (*mp));
142  mp->_vl_msg_id =
143  ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_TUNNEL_PROTECT_DETAILS);
144  mp->context = ctx->context;
145 
146  mp->tun.sw_if_index = htonl (itp->itp_sw_if_index);
147  ip_address_encode2 (itp->itp_key, &mp->tun.nh);
148 
149  sa = ipsec_sa_get (itp->itp_out_sa);
150  mp->tun.sa_out = htonl (sa->id);
151  mp->tun.n_sa_in = itp->itp_n_sa_in;
152  /* *INDENT-OFF* */
154  ({
155  mp->tun.sa_in[ii++] = htonl (sa->id);
156  }));
157  /* *INDENT-ON* */
158 
159  vl_api_send_msg (ctx->reg, (u8 *) mp);
160 
161  return (WALK_CONTINUE);
162 }
163 
164 static void
166  * mp)
167 {
170 
172  if (!reg)
173  return;
174 
176  .reg = reg,
177  .context = mp->context,
178  };
179 
180  sw_if_index = ntohl (mp->sw_if_index);
181 
182  if (~0 == sw_if_index)
183  {
185  }
186  else
187  {
190  }
191 }
192 
193 static int
194 ipsec_spd_action_decode (vl_api_ipsec_spd_action_t in,
195  ipsec_policy_action_t * out)
196 {
197  in = clib_net_to_host_u32 (in);
198 
199  switch (in)
200  {
201 #define _(v,f,s) case IPSEC_API_SPD_ACTION_##f: \
202  *out = IPSEC_POLICY_ACTION_##f; \
203  return (0);
205 #undef _
206  }
207  return (VNET_API_ERROR_UNIMPLEMENTED);
208 }
209 
212 {
213  vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
215  ip46_type_t itype;
216  u32 stat_index;
217  int rv;
218 
219  stat_index = ~0;
220 
221  ipsec_policy_t p;
222 
223  clib_memset (&p, 0, sizeof (p));
224 
225  p.id = ntohl (mp->entry.spd_id);
226  p.priority = ntohl (mp->entry.priority);
227 
228  itype = ip_address_decode (&mp->entry.remote_address_start, &p.raddr.start);
229  ip_address_decode (&mp->entry.remote_address_stop, &p.raddr.stop);
230  ip_address_decode (&mp->entry.local_address_start, &p.laddr.start);
231  ip_address_decode (&mp->entry.local_address_stop, &p.laddr.stop);
232 
233  p.is_ipv6 = (itype == IP46_TYPE_IP6);
234 
235  p.protocol = mp->entry.protocol;
236  p.rport.start = ntohs (mp->entry.remote_port_start);
237  p.rport.stop = ntohs (mp->entry.remote_port_stop);
238  p.lport.start = ntohs (mp->entry.local_port_start);
239  p.lport.stop = ntohs (mp->entry.local_port_stop);
240 
241  rv = ipsec_spd_action_decode (mp->entry.policy, &p.policy);
242 
243  if (rv)
244  goto out;
245 
246  /* policy action resolve unsupported */
247  if (p.policy == IPSEC_POLICY_ACTION_RESOLVE)
248  {
249  clib_warning ("unsupported action: 'resolve'");
250  rv = VNET_API_ERROR_UNIMPLEMENTED;
251  goto out;
252  }
253  p.sa_id = ntohl (mp->entry.sa_id);
254  rv =
255  ipsec_policy_mk_type (mp->entry.is_outbound, p.is_ipv6, p.policy,
256  &p.type);
257  if (rv)
258  goto out;
259 
260  rv = ipsec_add_del_policy (vm, &p, mp->is_add, &stat_index);
261  if (rv)
262  goto out;
263 
264 out:
265  /* *INDENT-OFF* */
266  REPLY_MACRO2 (VL_API_IPSEC_SPD_ENTRY_ADD_DEL_REPLY,
267  ({
268  rmp->stat_index = ntohl(stat_index);
269  }));
270  /* *INDENT-ON* */
271 }
272 
275 {
277  ipsec_key_t crypto_key, integ_key;
278  ipsec_crypto_alg_t crypto_alg;
279  ipsec_integ_alg_t integ_alg;
280  ipsec_protocol_t proto;
282  u32 id, spi, sa_index = ~0;
283  tunnel_t tun = {
284  .t_flags = TUNNEL_FLAG_NONE,
285  .t_encap_decap_flags = TUNNEL_ENCAP_DECAP_FLAG_NONE,
286  .t_dscp = 0,
287  .t_mode = TUNNEL_MODE_P2P,
288  .t_table_id = 0,
289  .t_hop_limit = 255,
290  };
291  int rv;
292 
293  id = ntohl (mp->entry.sad_id);
294  if (!mp->is_add)
295  {
296  rv = ipsec_sa_unlock_id (id);
297  goto out;
298  }
299  spi = ntohl (mp->entry.spi);
300 
301  rv = ipsec_proto_decode (mp->entry.protocol, &proto);
302 
303  if (rv)
304  goto out;
305 
306  rv = ipsec_crypto_algo_decode (mp->entry.crypto_algorithm, &crypto_alg);
307 
308  if (rv)
309  goto out;
310 
311  rv = ipsec_integ_algo_decode (mp->entry.integrity_algorithm, &integ_alg);
312 
313  if (rv)
314  goto out;
315 
316  ipsec_key_decode (&mp->entry.crypto_key, &crypto_key);
317  ipsec_key_decode (&mp->entry.integrity_key, &integ_key);
318 
319  flags = ipsec_sa_flags_decode (mp->entry.flags);
320 
321  ip_address_decode2 (&mp->entry.tunnel_src, &tun.t_src);
322  ip_address_decode2 (&mp->entry.tunnel_dst, &tun.t_dst);
323 
324  rv = ipsec_sa_add_and_lock (id, spi, proto, crypto_alg, &crypto_key,
325  integ_alg, &integ_key, flags, mp->entry.salt,
326  htons (mp->entry.udp_src_port),
327  htons (mp->entry.udp_dst_port), &tun, &sa_index);
328 
329 out:
330  /* *INDENT-OFF* */
331  REPLY_MACRO2 (VL_API_IPSEC_SAD_ENTRY_ADD_DEL_REPLY,
332  {
333  rmp->stat_index = htonl (sa_index);
334  });
335  /* *INDENT-ON* */
336 }
337 
340 {
341  vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
343  ipsec_key_t crypto_key, integ_key;
344  ipsec_crypto_alg_t crypto_alg;
345  ipsec_integ_alg_t integ_alg;
346  ipsec_protocol_t proto;
348  u32 id, spi, sa_index = ~0;
349  int rv;
350  tunnel_t tun = {
351  .t_flags = TUNNEL_FLAG_NONE,
352  .t_encap_decap_flags = TUNNEL_ENCAP_DECAP_FLAG_NONE,
353  .t_dscp = 0,
354  .t_mode = TUNNEL_MODE_P2P,
355  .t_table_id = htonl (mp->entry.tx_table_id),
356  .t_hop_limit = 255,
357  };
358 
359  id = ntohl (mp->entry.sad_id);
360  if (!mp->is_add)
361  {
362  rv = ipsec_sa_unlock_id (id);
363  goto out;
364  }
365 
366  spi = ntohl (mp->entry.spi);
367 
368  rv = ipsec_proto_decode (mp->entry.protocol, &proto);
369 
370  if (rv)
371  goto out;
372 
373  rv = ipsec_crypto_algo_decode (mp->entry.crypto_algorithm, &crypto_alg);
374 
375  if (rv)
376  goto out;
377 
378  rv = ipsec_integ_algo_decode (mp->entry.integrity_algorithm, &integ_alg);
379 
380  if (rv)
381  goto out;
382 
383  rv = tunnel_encap_decap_flags_decode (mp->entry.tunnel_flags,
384  &tun.t_encap_decap_flags);
385 
386  if (rv)
387  goto out;
388 
389  ipsec_key_decode (&mp->entry.crypto_key, &crypto_key);
390  ipsec_key_decode (&mp->entry.integrity_key, &integ_key);
391 
392  flags = ipsec_sa_flags_decode (mp->entry.flags);
393  tun.t_dscp = ip_dscp_decode (mp->entry.dscp);
394 
395  ip_address_decode2 (&mp->entry.tunnel_src, &tun.t_src);
396  ip_address_decode2 (&mp->entry.tunnel_dst, &tun.t_dst);
397 
399  id, spi, proto, crypto_alg, &crypto_key, integ_alg, &integ_key, flags,
400  mp->entry.salt, htons (mp->entry.udp_src_port),
401  htons (mp->entry.udp_dst_port), &tun, &sa_index);
402 
403 out:
404  /* *INDENT-OFF* */
405  REPLY_MACRO2 (VL_API_IPSEC_SAD_ENTRY_ADD_DEL_V2_REPLY,
406  {
407  rmp->stat_index = htonl (sa_index);
408  });
409  /* *INDENT-ON* */
410 }
411 
412 static int
413 ipsec_sad_entry_add_v3 (const vl_api_ipsec_sad_entry_v3_t *entry,
414  u32 *sa_index)
415 {
416  ipsec_key_t crypto_key, integ_key;
417  ipsec_crypto_alg_t crypto_alg;
418  ipsec_integ_alg_t integ_alg;
419  ipsec_protocol_t proto;
421  u32 id, spi;
422  tunnel_t tun;
423  int rv;
424 
425  id = ntohl (entry->sad_id);
426  spi = ntohl (entry->spi);
427 
428  rv = ipsec_proto_decode (entry->protocol, &proto);
429 
430  if (rv)
431  return (rv);
432 
433  rv = ipsec_crypto_algo_decode (entry->crypto_algorithm, &crypto_alg);
434 
435  if (rv)
436  return (rv);
437 
438  rv = ipsec_integ_algo_decode (entry->integrity_algorithm, &integ_alg);
439 
440  if (rv)
441  return (rv);
442 
443  flags = ipsec_sa_flags_decode (entry->flags);
444 
445  if (flags & IPSEC_SA_FLAG_IS_TUNNEL)
446  {
447  rv = tunnel_decode (&entry->tunnel, &tun);
448 
449  if (rv)
450  return (rv);
451  }
452 
453  ipsec_key_decode (&entry->crypto_key, &crypto_key);
454  ipsec_key_decode (&entry->integrity_key, &integ_key);
455 
456  return ipsec_sa_add_and_lock (id, spi, proto, crypto_alg, &crypto_key,
457  integ_alg, &integ_key, flags, entry->salt,
458  htons (entry->udp_src_port),
459  htons (entry->udp_dst_port), &tun, sa_index);
460 }
461 
462 static void
465 {
467  u32 id, sa_index = ~0;
468  int rv;
469 
470  id = ntohl (mp->entry.sad_id);
471 
472  if (!mp->is_add)
473  {
474  rv = ipsec_sa_unlock_id (id);
475  }
476  else
477  {
478  rv = ipsec_sad_entry_add_v3 (&mp->entry, &sa_index);
479  }
480 
481  REPLY_MACRO2 (VL_API_IPSEC_SAD_ENTRY_ADD_DEL_V3_REPLY,
482  { rmp->stat_index = htonl (sa_index); });
483 }
484 
485 static void
487 {
488  vl_api_ipsec_sad_entry_del_reply_t *rmp;
489  int rv;
490 
491  rv = ipsec_sa_unlock_id (ntohl (mp->id));
492 
493  REPLY_MACRO (VL_API_IPSEC_SAD_ENTRY_DEL_REPLY);
494 }
495 
496 static void
498 {
500  u32 sa_index = ~0;
501  int rv;
502 
503  rv = ipsec_sad_entry_add_v3 (&mp->entry, &sa_index);
504 
505  REPLY_MACRO2 (VL_API_IPSEC_SAD_ENTRY_ADD_REPLY,
506  { rmp->stat_index = htonl (sa_index); });
507 }
508 
509 static void
511  u32 context)
512 {
514  u32 n_policies = 0;
515 
516  mp = vl_msg_api_alloc (sizeof (*mp));
517  clib_memset (mp, 0, sizeof (*mp));
518  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_SPDS_DETAILS);
519  mp->context = context;
520 
521  mp->spd_id = htonl (spd->id);
522 #define _(s, n) n_policies += vec_len (spd->policies[IPSEC_SPD_POLICY_##s]);
524 #undef _
525  mp->npolicies = htonl (n_policies);
526 
527  vl_api_send_msg (reg, (u8 *) mp);
528 }
529 
530 static void
532 {
535  ipsec_spd_t *spd;
536 
538  if (!reg)
539  return;
540 
541  pool_foreach (spd, im->spds) {
542  send_ipsec_spds_details (spd, reg, mp->context);
543  }
544 }
545 
546 vl_api_ipsec_spd_action_t
548 {
549  vl_api_ipsec_spd_action_t out = IPSEC_API_SPD_ACTION_BYPASS;
550 
551  switch (in)
552  {
553 #define _(v,f,s) case IPSEC_POLICY_ACTION_##f: \
554  out = IPSEC_API_SPD_ACTION_##f; \
555  break;
557 #undef _
558  }
559  return (clib_host_to_net_u32 (out));
560 }
561 
562 static void
564  u32 context)
565 {
567 
568  mp = vl_msg_api_alloc (sizeof (*mp));
569  clib_memset (mp, 0, sizeof (*mp));
570  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_SPD_DETAILS);
571  mp->context = context;
572 
573  mp->entry.spd_id = htonl (p->id);
574  mp->entry.priority = htonl (p->priority);
575  mp->entry.is_outbound = ((p->type == IPSEC_SPD_POLICY_IP6_OUTBOUND) ||
576  (p->type == IPSEC_SPD_POLICY_IP4_OUTBOUND));
577 
579  &mp->entry.local_address_start);
581  &mp->entry.local_address_stop);
583  &mp->entry.remote_address_start);
585  &mp->entry.remote_address_stop);
586  mp->entry.local_port_start = htons (p->lport.start);
587  mp->entry.local_port_stop = htons (p->lport.stop);
588  mp->entry.remote_port_start = htons (p->rport.start);
589  mp->entry.remote_port_stop = htons (p->rport.stop);
590  mp->entry.protocol = p->protocol;
591  mp->entry.policy = ipsec_spd_action_encode (p->policy);
592  mp->entry.sa_id = htonl (p->sa_id);
593 
594  vl_api_send_msg (reg, (u8 *) mp);
595 }
596 
597 static void
599 {
604  ipsec_spd_t *spd;
605  uword *p;
606  u32 spd_index, *ii;
607 
609  if (!reg)
610  return;
611 
612  p = hash_get (im->spd_index_by_spd_id, ntohl (mp->spd_id));
613  if (!p)
614  return;
615 
616  spd_index = p[0];
617  spd = pool_elt_at_index (im->spds, spd_index);
618 
620  vec_foreach(ii, spd->policies[ptype])
621  {
622  policy = pool_elt_at_index(im->policies, *ii);
623 
624  if (mp->sa_id == ~(0) || ntohl (mp->sa_id) == policy->sa_id)
626  }
627  }
628 }
629 
630 static void
633 {
635 
636  mp = vl_msg_api_alloc (sizeof (*mp));
637  clib_memset (mp, 0, sizeof (*mp));
638  mp->_vl_msg_id =
639  ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_SPD_INTERFACE_DETAILS);
640  mp->context = context;
641 
642  mp->spd_index = htonl (spd_index);
643  mp->sw_if_index = htonl (sw_if_index);
644 
645  vl_api_send_msg (reg, (u8 *) mp);
646 }
647 
648 static void
650  mp)
651 {
654  u32 k, v, spd_index;
655 
657  if (!reg)
658  return;
659 
660  if (mp->spd_index_valid)
661  {
662  spd_index = ntohl (mp->spd_index);
663  /* *INDENT-OFF* */
664  hash_foreach(k, v, im->spd_index_by_sw_if_index, ({
665  if (v == spd_index)
666  send_ipsec_spd_interface_details(reg, v, k, mp->context);
667  }));
668  /* *INDENT-ON* */
669  }
670  else
671  {
672  hash_foreach(k, v, im->spd_index_by_sw_if_index, ({
673  send_ipsec_spd_interface_details(reg, v, k, mp->context);
674  }));
675  }
676 }
677 
678 static void
680 {
683  u32 sw_if_index = ~0;
684  int rv;
685 
686  rv = tunnel_mode_decode (mp->itf.mode, &mode);
687 
688  if (!rv)
689  rv = ipsec_itf_create (ntohl (mp->itf.user_instance), mode, &sw_if_index);
690 
691  /* *INDENT-OFF* */
692  REPLY_MACRO2 (VL_API_IPSEC_ITF_CREATE_REPLY,
693  ({
694  rmp->sw_if_index = htonl (sw_if_index);
695  }));
696  /* *INDENT-ON* */
697 }
698 
699 static void
701 {
702  vl_api_ipsec_itf_delete_reply_t *rmp;
703  int rv;
704 
705  rv = ipsec_itf_delete (ntohl (mp->sw_if_index));
706 
707  REPLY_MACRO (VL_API_IPSEC_ITF_DELETE_REPLY);
708 }
709 
710 static walk_rc_t
712 {
713  ipsec_dump_walk_ctx_t *ctx = arg;
715 
716  mp = vl_msg_api_alloc (sizeof (*mp));
717  clib_memset (mp, 0, sizeof (*mp));
718  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_ITF_DETAILS);
719  mp->context = ctx->context;
720 
721  mp->itf.mode = tunnel_mode_encode (itf->ii_mode);
722  mp->itf.user_instance = htonl (itf->ii_user_instance);
723  mp->itf.sw_if_index = htonl (itf->ii_sw_if_index);
724  vl_api_send_msg (ctx->reg, (u8 *) mp);
725 
726  return (WALK_CONTINUE);
727 }
728 
729 static void
731 {
733 
735  if (!reg)
736  return;
737 
739  .reg = reg,
740  .context = mp->context,
741  };
742 
744 }
745 
747 {
751 
752 static walk_rc_t
754 {
756  ipsec_tun_protect_t *itp;
757  index_t sai;
758 
759  itp = ipsec_tun_protect_get (itpi);
760 
761  if (itp->itp_out_sa == ctx->sai)
762  {
763  ctx->sw_if_index = itp->itp_sw_if_index;
764  return (WALK_STOP);
765  }
766 
768  ({
769  if (sai == ctx->sai)
770  {
771  ctx->sw_if_index = itp->itp_sw_if_index;
772  return (WALK_STOP);
773  }
774  }));
775 
776  return (WALK_CONTINUE);
777 }
778 
779 static walk_rc_t
781 {
782  ipsec_dump_walk_ctx_t *ctx = arg;
784 
785  mp = vl_msg_api_alloc (sizeof (*mp));
786  clib_memset (mp, 0, sizeof (*mp));
787  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_SA_DETAILS);
788  mp->context = ctx->context;
789 
790  mp->entry.sad_id = htonl (sa->id);
791  mp->entry.spi = htonl (sa->spi);
792  mp->entry.protocol = ipsec_proto_encode (sa->protocol);
793  mp->entry.tx_table_id = htonl (sa->tunnel.t_table_id);
794 
795  mp->entry.crypto_algorithm = ipsec_crypto_algo_encode (sa->crypto_alg);
796  ipsec_key_encode (&sa->crypto_key, &mp->entry.crypto_key);
797 
798  mp->entry.integrity_algorithm = ipsec_integ_algo_encode (sa->integ_alg);
799  ipsec_key_encode (&sa->integ_key, &mp->entry.integrity_key);
800 
801  mp->entry.flags = ipsec_sad_flags_encode (sa);
802  mp->entry.salt = clib_host_to_net_u32 (sa->salt);
803 
804  if (ipsec_sa_is_set_IS_PROTECT (sa))
805  {
807  .sai = sa - ipsec_sa_pool,
808  .sw_if_index = ~0,
809  };
811 
812  mp->sw_if_index = htonl (ctx.sw_if_index);
813  }
814  else
815  mp->sw_if_index = ~0;
816 
817  if (ipsec_sa_is_set_IS_TUNNEL (sa))
818  {
819  ip_address_encode2 (&sa->tunnel.t_src, &mp->entry.tunnel_src);
820  ip_address_encode2 (&sa->tunnel.t_dst, &mp->entry.tunnel_dst);
821  }
822  if (ipsec_sa_is_set_UDP_ENCAP (sa))
823  {
824  mp->entry.udp_src_port = sa->udp_hdr.src_port;
825  mp->entry.udp_dst_port = sa->udp_hdr.dst_port;
826  }
827 
828  mp->seq_outbound = clib_host_to_net_u64 (((u64) sa->seq));
829  mp->last_seq_inbound = clib_host_to_net_u64 (((u64) sa->seq));
830  if (ipsec_sa_is_set_USE_ESN (sa))
831  {
832  mp->seq_outbound |= (u64) (clib_host_to_net_u32 (sa->seq_hi));
833  mp->last_seq_inbound |= (u64) (clib_host_to_net_u32 (sa->seq_hi));
834  }
835  if (ipsec_sa_is_set_USE_ANTI_REPLAY (sa))
836  mp->replay_window = clib_host_to_net_u64 (sa->replay_window);
837 
838  mp->stat_index = clib_host_to_net_u32 (sa->stat_index);
839 
840  vl_api_send_msg (ctx->reg, (u8 *) mp);
841 
842  return (WALK_CONTINUE);
843 }
844 
845 static void
847 {
849 
851  if (!reg)
852  return;
853 
855  .reg = reg,
856  .context = mp->context,
857  };
858 
860 }
861 
862 static walk_rc_t
864 {
865  ipsec_dump_walk_ctx_t *ctx = arg;
867 
868  mp = vl_msg_api_alloc (sizeof (*mp));
869  clib_memset (mp, 0, sizeof (*mp));
870  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_SA_V2_DETAILS);
871  mp->context = ctx->context;
872 
873  mp->entry.sad_id = htonl (sa->id);
874  mp->entry.spi = htonl (sa->spi);
875  mp->entry.protocol = ipsec_proto_encode (sa->protocol);
876  mp->entry.tx_table_id = htonl (sa->tunnel.t_table_id);
877 
878  mp->entry.crypto_algorithm = ipsec_crypto_algo_encode (sa->crypto_alg);
879  ipsec_key_encode (&sa->crypto_key, &mp->entry.crypto_key);
880 
881  mp->entry.integrity_algorithm = ipsec_integ_algo_encode (sa->integ_alg);
882  ipsec_key_encode (&sa->integ_key, &mp->entry.integrity_key);
883 
884  mp->entry.flags = ipsec_sad_flags_encode (sa);
885  mp->entry.salt = clib_host_to_net_u32 (sa->salt);
886 
887  if (ipsec_sa_is_set_IS_PROTECT (sa))
888  {
890  .sai = sa - ipsec_sa_pool,
891  .sw_if_index = ~0,
892  };
894 
895  mp->sw_if_index = htonl (ctx.sw_if_index);
896  }
897  else
898  mp->sw_if_index = ~0;
899 
900  if (ipsec_sa_is_set_IS_TUNNEL (sa))
901  {
902  ip_address_encode2 (&sa->tunnel.t_src, &mp->entry.tunnel_src);
903  ip_address_encode2 (&sa->tunnel.t_dst, &mp->entry.tunnel_dst);
904  }
905  if (ipsec_sa_is_set_UDP_ENCAP (sa))
906  {
907  mp->entry.udp_src_port = sa->udp_hdr.src_port;
908  mp->entry.udp_dst_port = sa->udp_hdr.dst_port;
909  }
910 
911  mp->entry.tunnel_flags =
913  mp->entry.dscp = ip_dscp_encode (sa->tunnel.t_dscp);
914 
915  mp->seq_outbound = clib_host_to_net_u64 (((u64) sa->seq));
916  mp->last_seq_inbound = clib_host_to_net_u64 (((u64) sa->seq));
917  if (ipsec_sa_is_set_USE_ESN (sa))
918  {
919  mp->seq_outbound |= (u64) (clib_host_to_net_u32 (sa->seq_hi));
920  mp->last_seq_inbound |= (u64) (clib_host_to_net_u32 (sa->seq_hi));
921  }
922  if (ipsec_sa_is_set_USE_ANTI_REPLAY (sa))
923  mp->replay_window = clib_host_to_net_u64 (sa->replay_window);
924 
925  mp->stat_index = clib_host_to_net_u32 (sa->stat_index);
926 
927  vl_api_send_msg (ctx->reg, (u8 *) mp);
928 
929  return (WALK_CONTINUE);
930 }
931 
932 static void
934 {
936 
938  if (!reg)
939  return;
940 
942  .reg = reg,
943  .context = mp->context,
944  };
945 
947 }
948 
949 static walk_rc_t
951 {
952  ipsec_dump_walk_ctx_t *ctx = arg;
954 
955  mp = vl_msg_api_alloc (sizeof (*mp));
956  clib_memset (mp, 0, sizeof (*mp));
957  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_SA_V3_DETAILS);
958  mp->context = ctx->context;
959 
960  mp->entry.sad_id = htonl (sa->id);
961  mp->entry.spi = htonl (sa->spi);
962  mp->entry.protocol = ipsec_proto_encode (sa->protocol);
963 
964  mp->entry.crypto_algorithm = ipsec_crypto_algo_encode (sa->crypto_alg);
965  ipsec_key_encode (&sa->crypto_key, &mp->entry.crypto_key);
966 
967  mp->entry.integrity_algorithm = ipsec_integ_algo_encode (sa->integ_alg);
968  ipsec_key_encode (&sa->integ_key, &mp->entry.integrity_key);
969 
970  mp->entry.flags = ipsec_sad_flags_encode (sa);
971  mp->entry.salt = clib_host_to_net_u32 (sa->salt);
972 
973  if (ipsec_sa_is_set_IS_PROTECT (sa))
974  {
976  .sai = sa - ipsec_sa_pool,
977  .sw_if_index = ~0,
978  };
980 
981  mp->sw_if_index = htonl (ctx.sw_if_index);
982  }
983  else
984  mp->sw_if_index = ~0;
985 
986  if (ipsec_sa_is_set_IS_TUNNEL (sa))
987  tunnel_encode (&sa->tunnel, &mp->entry.tunnel);
988 
989  if (ipsec_sa_is_set_UDP_ENCAP (sa))
990  {
991  mp->entry.udp_src_port = sa->udp_hdr.src_port;
992  mp->entry.udp_dst_port = sa->udp_hdr.dst_port;
993  }
994 
995  mp->seq_outbound = clib_host_to_net_u64 (((u64) sa->seq));
996  mp->last_seq_inbound = clib_host_to_net_u64 (((u64) sa->seq));
997  if (ipsec_sa_is_set_USE_ESN (sa))
998  {
999  mp->seq_outbound |= (u64) (clib_host_to_net_u32 (sa->seq_hi));
1000  mp->last_seq_inbound |= (u64) (clib_host_to_net_u32 (sa->seq_hi));
1001  }
1002  if (ipsec_sa_is_set_USE_ANTI_REPLAY (sa))
1003  mp->replay_window = clib_host_to_net_u64 (sa->replay_window);
1004 
1005  mp->stat_index = clib_host_to_net_u32 (sa->stat_index);
1006 
1007  vl_api_send_msg (ctx->reg, (u8 *) mp);
1008 
1009  return (WALK_CONTINUE);
1010 }
1011 
1012 static void
1014 {
1015  vl_api_registration_t *reg;
1016 
1018  if (!reg)
1019  return;
1020 
1022  .reg = reg,
1023  .context = mp->context,
1024  };
1025 
1027 }
1028 
1029 static void
1031 {
1034  u32 context = mp->context;
1035 
1037 
1038  if (rp == 0)
1039  {
1040  clib_warning ("Client %d AWOL", mp->client_index);
1041  return;
1042  }
1043 
1044  ipsec_ah_backend_t *ab;
1045  ipsec_esp_backend_t *eb;
1046  /* *INDENT-OFF* */
1047  pool_foreach (ab, im->ah_backends) {
1048  vl_api_ipsec_backend_details_t *mp = vl_msg_api_alloc (sizeof (*mp));
1049  clib_memset (mp, 0, sizeof (*mp));
1050  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_BACKEND_DETAILS);
1051  mp->context = context;
1052  snprintf ((char *)mp->name, sizeof (mp->name), "%.*s", vec_len (ab->name),
1053  ab->name);
1054  mp->protocol = ntohl (IPSEC_API_PROTO_AH);
1055  mp->index = ab - im->ah_backends;
1056  mp->active = mp->index == im->ah_current_backend ? 1 : 0;
1057  vl_api_send_msg (rp, (u8 *)mp);
1058  }
1059  pool_foreach (eb, im->esp_backends) {
1060  vl_api_ipsec_backend_details_t *mp = vl_msg_api_alloc (sizeof (*mp));
1061  clib_memset (mp, 0, sizeof (*mp));
1062  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_IPSEC_BACKEND_DETAILS);
1063  mp->context = context;
1064  snprintf ((char *)mp->name, sizeof (mp->name), "%.*s", vec_len (eb->name),
1065  eb->name);
1066  mp->protocol = ntohl (IPSEC_API_PROTO_ESP);
1067  mp->index = eb - im->esp_backends;
1068  mp->active = mp->index == im->esp_current_backend ? 1 : 0;
1069  vl_api_send_msg (rp, (u8 *)mp);
1070  }
1071  /* *INDENT-ON* */
1072 }
1073 
1074 static void
1076 {
1078  vl_api_ipsec_select_backend_reply_t *rmp;
1079  ipsec_protocol_t protocol;
1080  int rv = 0;
1081  if (pool_elts (ipsec_sa_pool) > 0)
1082  {
1083  rv = VNET_API_ERROR_INSTANCE_IN_USE;
1084  goto done;
1085  }
1086 
1088 
1089  if (rv)
1090  goto done;
1091 
1092  switch (protocol)
1093  {
1094  case IPSEC_PROTOCOL_ESP:
1096  break;
1097  case IPSEC_PROTOCOL_AH:
1099  break;
1100  default:
1101  rv = VNET_API_ERROR_INVALID_PROTOCOL;
1102  break;
1103  }
1104 done:
1105  REPLY_MACRO (VL_API_IPSEC_SELECT_BACKEND_REPLY);
1106 }
1107 
1108 static void
1110 {
1111  vl_api_ipsec_set_async_mode_reply_t *rmp;
1112  int rv = 0;
1113 
1115 
1116  REPLY_MACRO (VL_API_IPSEC_SET_ASYNC_MODE_REPLY);
1117 }
1118 
1119 #include <vnet/ipsec/ipsec.api.c>
1120 static clib_error_t *
1122 {
1123  /*
1124  * Set up the (msg_name, crc, message-id) table
1125  */
1127 
1128  return 0;
1129 }
1130 
1132 
1133 /*
1134  * fd.io coding-style-patch-verification: ON
1135  *
1136  * Local Variables:
1137  * eval: (c-set-style "gnu")
1138  * End:
1139  */
ipsec_integ_algo_decode
int ipsec_integ_algo_decode(vl_api_ipsec_integ_alg_t in, ipsec_integ_alg_t *out)
Definition: ipsec_types_api.c:84
vl_api_ipsec_sa_dump_t
Dump IPsec security association.
Definition: ipsec.api:413
ipsec.h
vl_api_ipsec_sa_v3_details_t::last_seq_inbound
u64 last_seq_inbound
Definition: ipsec.api:476
ip_address
Definition: ip_types.h:79
ipsec_dump_walk_ctx_t_::reg
vl_api_registration_t * reg
Definition: ipsec_api.c:125
ipsec_dump_walk_ctx_t_::context
u32 context
Definition: ipsec_api.c:126
tunnel_t_::t_dscp
ip_dscp_t t_dscp
Definition: tunnel.h:93
vl_api_ipsec_spd_interface_details_t::context
u32 context
Definition: ipsec.api:356
vl_api_ipsec_backend_dump_t::context
u32 context
Definition: ipsec.api:488
vl_api_ipsec_spd_dump_t::spd_id
u32 spd_id
Definition: ipsec.api:172
vl_api_ipsec_sa_v2_details_t::entry
vl_api_ipsec_sad_entry_v2_t entry
Definition: ipsec.api:460
vl_api_ipsec_tunnel_protect_del_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:316
vl_api_ipsec_sa_v3_details_t::entry
vl_api_ipsec_sad_entry_v3_t entry
Definition: ipsec.api:472
vl_api_ipsec_backend_dump_t
Dump IPsec backends.
Definition: ipsec.api:486
ipsec_dump_walk_ctx_t_
Definition: ipsec_api.c:123
im
vnet_interface_main_t * im
Definition: interface_output.c:415
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
udp_header_t::src_port
u16 src_port
Definition: udp_packet.h:48
fib.h
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
ipsec_tun.h
ipsec_add_del_spd
int ipsec_add_del_spd(vlib_main_t *vm, u32 spd_id, int is_add)
Add/Delete a SPD.
Definition: ipsec_spd.c:20
api.h
ipsec_sa_t::protocol
ipsec_protocol_t protocol
Definition: ipsec_sa.h:174
tunnel_mode_encode
vl_api_tunnel_mode_t tunnel_mode_encode(tunnel_mode_t in)
Definition: tunnel_types_api.c:85
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
vl_api_ipsec_sa_v3_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:474
ipsec_itf_t_::ii_mode
tunnel_mode_t ii_mode
Definition: ipsec_itf.h:96
crypto_key
vl_api_key_t crypto_key
Definition: ipsec_types.api:129
vl_api_ipsec_interface_add_del_spd_t::spd_id
u32 spd_id
Definition: ipsec.api:57
ipsec_itf_t_::ii_sw_if_index
u32 ii_sw_if_index
Definition: ipsec_itf.h:98
WALK_CONTINUE
@ WALK_CONTINUE
Definition: interface_funcs.h:174
ipsec_spd_action_decode
static int ipsec_spd_action_decode(vl_api_ipsec_spd_action_t in, ipsec_policy_action_t *out)
Definition: ipsec_api.c:194
vl_api_ipsec_sa_v2_details_t::seq_outbound
u64 seq_outbound
Definition: ipsec.api:464
ipsec_policy_t_::priority
i32 priority
Definition: ipsec_spd_policy.h:57
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
ipsec_sa_dump_match_ctx_t
struct ipsec_sa_dump_match_ctx_t_ ipsec_sa_dump_match_ctx_t
vl_api_ipsec_tunnel_protect_del_t::nh
vl_api_address_t nh
Definition: ipsec.api:317
port_range_t::stop
u16 stop
Definition: ipsec_spd_policy.h:42
vl_api_ipsec_itf_details_t::itf
vl_api_ipsec_itf_t itf
Definition: ipsec.api:405
vl_api_ipsec_sad_entry_add_del_v3_t
Definition: ipsec.api:207
vl_api_ipsec_sad_entry_add_del_t
IPsec: Add/delete Security Association Database entry.
Definition: ipsec.api:192
ipsec_policy_t_::raddr
ip46_address_range_t raddr
Definition: ipsec_spd_policy.h:65
vl_api_ipsec_sad_entry_add_del_v3_reply_t
Definition: ipsec.api:240
tunnel_t_::t_src
ip_address_t t_src
Definition: tunnel.h:87
vl_api_ipsec_spd_details_t
IPsec policy database response.
Definition: ipsec.api:182
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_ipsec_sa_v2_dump_t
Definition: ipsec.api:420
policy
vl_api_ipsec_spd_action_t policy
Definition: ipsec.api:99
foreach_ipsec_spd_policy_type
#define foreach_ipsec_spd_policy_type
Definition: ipsec_spd.h:20
vl_api_ipsec_spd_add_del_t::is_add
bool is_add
Definition: ipsec.api:36
vl_api_ipsec_select_backend_t_handler
static void vl_api_ipsec_select_backend_t_handler(vl_api_ipsec_select_backend_t *mp)
Definition: ipsec_api.c:1075
vl_api_ipsec_sa_details_t::stat_index
u32 stat_index
Definition: ipsec.api:456
vl_api_ipsec_spd_entry_add_del_t::is_add
bool is_add
Definition: ipsec.api:126
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
tunnel_t_
A representation of an IP tunnel config.
Definition: tunnel.h:85
ipsec_itf_t_
A dedicated IPSec interface type.
Definition: ipsec_itf.h:94
vl_api_ipsec_sa_dump_t::client_index
u32 client_index
Definition: ipsec.api:416
ip_dscp_encode
vl_api_ip_dscp_t ip_dscp_encode(ip_dscp_t dscp)
Definition: ip_types_api.c:91
vl_api_ipsec_itf_create_reply_t
Add IPsec interface interface response.
Definition: ipsec.api:381
vl_api_ipsec_backend_dump_t_handler
static void vl_api_ipsec_backend_dump_t_handler(vl_api_ipsec_backend_dump_t *mp)
Definition: ipsec_api.c:1030
vl_api_ipsec_spd_entry_add_del_reply_t
IPsec: Reply Add/delete Security Policy Database entry.
Definition: ipsec.api:136
vl_api_ipsec_sa_details_t::last_seq_inbound
u64 last_seq_inbound
Definition: ipsec.api:453
vl_api_ipsec_sa_v2_details_t::last_seq_inbound
u64 last_seq_inbound
Definition: ipsec.api:465
vl_api_ipsec_sa_v3_details_t::replay_window
u64 replay_window
Definition: ipsec.api:477
ipsec_key_encode
void ipsec_key_encode(const ipsec_key_t *in, vl_api_key_t *out)
Definition: ipsec_types_api.c:122
send_ipsec_sa_details
static walk_rc_t send_ipsec_sa_details(ipsec_sa_t *sa, void *arg)
Definition: ipsec_api.c:780
hash_foreach
#define hash_foreach(key_var, value_var, h, body)
Definition: hash.h:441
vl_api_ipsec_itf_dump_t
Definition: ipsec.api:395
vl_api_ipsec_tunnel_protect_dump_t::context
u32 context
Definition: ipsec.api:326
ipsec_proto_encode
vl_api_ipsec_proto_t ipsec_proto_encode(ipsec_protocol_t p)
Definition: ipsec_types_api.c:38
mode
vl_api_tunnel_mode_t mode
Definition: gre.api:48
vl_api_ipsec_itf_create_reply_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:385
tunnel_types_api.h
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
ipsec_set_interface_spd
int ipsec_set_interface_spd(vlib_main_t *vm, u32 sw_if_index, u32 spd_id, int is_add)
Bind/attach a SPD to an interface.
Definition: ipsec_spd.c:63
ipsec_tun_protect_t_::itp_sw_if_index
u32 itp_sw_if_index
Definition: ipsec_tun.h:117
vl_api_ipsec_sa_details_t::context
u32 context
Definition: ipsec.api:447
vl_api_ipsec_sa_v3_details_t
Definition: ipsec.api:470
ipsec_sa_dump_match_sa
static walk_rc_t ipsec_sa_dump_match_sa(index_t itpi, void *arg)
Definition: ipsec_api.c:753
vl_api_ipsec_spd_details_t::context
u32 context
Definition: ipsec.api:183
vl_api_ipsec_tunnel_protect_details_t::tun
vl_api_ipsec_tunnel_protect_t tun
Definition: ipsec.api:333
vl_api_ipsec_sad_entry_add_del_v2_reply_t
Definition: ipsec.api:234
vl_api_ipsec_sad_entry_del_t::id
u32 id
Definition: ipsec.api:224
vl_api_ipsec_spd_details_t::entry
vl_api_ipsec_spd_entry_t entry
Definition: ipsec.api:184
vl_api_ipsec_spd_interface_dump_t::spd_index
u32 spd_index
Definition: ipsec.api:346
vl_api_ipsec_sa_v3_details_t::seq_outbound
u64 seq_outbound
Definition: ipsec.api:475
vl_api_ipsec_sa_v3_details_t::stat_index
u32 stat_index
Definition: ipsec.api:479
TUNNEL_FLAG_NONE
@ TUNNEL_FLAG_NONE
Definition: tunnel.h:71
IPSEC_PROTOCOL_ESP
@ IPSEC_PROTOCOL_ESP
Definition: ipsec_sa.h:76
ipsec_sa_walk
void ipsec_sa_walk(ipsec_sa_walk_cb_t cb, void *ctx)
Definition: ipsec_sa.c:428
vl_api_ipsec_sad_entry_add_del_t::is_add
bool is_add
Definition: ipsec.api:197
ipsec_sa_t::crypto_key
ipsec_key_t crypto_key
Definition: ipsec_sa.h:219
ipsec_policy_action_t
ipsec_policy_action_t
Definition: ipsec_spd_policy.h:26
ipsec_ah_backend_t
Definition: ipsec.h:37
ipsec_sa_t::tunnel
tunnel_t tunnel
Definition: ipsec_sa.h:204
vl_api_ipsec_spd_dump_t_handler
static void vl_api_ipsec_spd_dump_t_handler(vl_api_ipsec_spd_dump_t *mp)
Definition: ipsec_api.c:598
ipsec_policy_t_::is_ipv6
u8 is_ipv6
Definition: ipsec_spd_policy.h:63
vl_api_ipsec_set_async_mode_t
IPsec Set Async mode.
Definition: ipsec.api:524
foreach_ipsec_policy_action
@ foreach_ipsec_policy_action
Definition: ipsec_spd_policy.h:29
vl_api_ipsec_itf_dump_t_handler
static void vl_api_ipsec_itf_dump_t_handler(vl_api_ipsec_itf_dump_t *mp)
Definition: ipsec_api.c:730
vl_api_ipsec_spds_details_t::npolicies
u32 npolicies
Definition: ipsec.api:160
vl_api_ipsec_spd_add_del_t
IPsec: Add/delete Security Policy Database.
Definition: ipsec.api:32
vl_api_ipsec_sa_v3_dump_t_handler
static void vl_api_ipsec_sa_v3_dump_t_handler(vl_api_ipsec_sa_v3_dump_t *mp)
Definition: ipsec_api.c:1013
ipsec_sa_dump_match_ctx_t_::sw_if_index
u32 sw_if_index
Definition: ipsec_api.c:749
ipsec_sa_t::udp_hdr
udp_header_t udp_hdr
Definition: ipsec_sa.h:169
vl_api_ipsec_tunnel_protect_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:327
vl_api_ipsec_spd_entry_add_del_t
IPsec: Add/delete Security Policy Database entry.
Definition: ipsec.api:122
ipsec_key_decode
void ipsec_key_decode(const vl_api_key_t *key, ipsec_key_t *out)
Definition: ipsec_types_api.c:116
vl_api_ipsec_tunnel_protect_details_t
Definition: ipsec.api:330
ip_address_encode2
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
Definition: ip_types_api.c:228
ip_address_decode
ip46_type_t ip_address_decode(const vl_api_address_t *in, ip46_address_t *out)
Decode/Encode for struct/union types.
Definition: ip_types_api.c:172
ipsec_spd_t::id
u32 id
the User's ID for this policy
Definition: ipsec_spd.h:49
FOR_EACH_IPSEC_SPD_POLICY_TYPE
#define FOR_EACH_IPSEC_SPD_POLICY_TYPE(_t)
Definition: ipsec_spd.h:38
send_ipsec_spd_interface_details
static void send_ipsec_spd_interface_details(vl_api_registration_t *reg, u32 spd_index, u32 sw_if_index, u32 context)
Definition: ipsec_api.c:631
vl_api_ipsec_sad_entry_add_del_v3_reply_t::stat_index
u32 stat_index
Definition: ipsec.api:244
FOR_EACH_IPSEC_PROTECT_INPUT_SAI
#define FOR_EACH_IPSEC_PROTECT_INPUT_SAI(_itp, _sai, body)
Definition: ipsec_tun.h:130
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
ipsec_itf_t_::ii_user_instance
int ii_user_instance
Definition: ipsec_itf.h:97
ipsec_itf_create
int ipsec_itf_create(u32 user_instance, tunnel_mode_t mode, u32 *sw_if_indexp)
Definition: ipsec_itf.c:272
ipsec_sa_flags_t
enum ipsec_sad_flags_t_ ipsec_sa_flags_t
vl_api_ipsec_sa_v2_details_t::stat_index
u32 stat_index
Definition: ipsec.api:468
tunnel_encap_decap_flags_decode
int tunnel_encap_decap_flags_decode(vl_api_tunnel_encap_decap_flags_t f, tunnel_encap_decap_flags_t *o)
Conversion functions to/from (decode/encode) API types to VPP internal types.
Definition: tunnel_types_api.c:34
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vl_api_ipsec_interface_add_del_spd_t
IPsec: Add/delete SPD from interface.
Definition: ipsec.api:50
vl_api_ipsec_spds_dump_t
Dump IPsec all SPD IDs.
Definition: ipsec.api:147
send_ipsec_spds_details
static void send_ipsec_spds_details(ipsec_spd_t *spd, vl_api_registration_t *reg, u32 context)
Definition: ipsec_api.c:510
ipsec_esp_backend_t::name
u8 * name
Definition: ipsec.h:56
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
vl_api_ipsec_sad_entry_add_reply_t::stat_index
u32 stat_index
Definition: ipsec.api:250
ipsec_tun_protect_t_
Definition: ipsec_tun.h:107
ipsec_itf.h
ipsec_sa_t::replay_window
u64 replay_window
Definition: ipsec_sa.h:134
ipsec_policy_mk_type
int ipsec_policy_mk_type(bool is_outbound, bool is_ipv6, ipsec_policy_action_t action, ipsec_spd_policy_type_t *type)
Definition: ipsec_spd_policy.c:100
ipsec_sa_get
static ipsec_sa_t * ipsec_sa_get(u32 sa_index)
Definition: ipsec_sa.h:605
vl_api_ipsec_backend_details_t::name
string name[128]
Definition: ipsec.api:499
ip46_address_range_t::stop
ip46_address_t stop
Definition: ipsec_spd_policy.h:37
ipsec_sa_t::integ_key
ipsec_key_t integ_key
Definition: ipsec_sa.h:218
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
hash_get
#define hash_get(h, key)
Definition: hash.h:249
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: sr_mpls_api.c:174
ipsec_main_t
Definition: ipsec.h:108
vl_api_ipsec_spd_add_del_t::spd_id
u32 spd_id
Definition: ipsec.api:37
vl_api_ipsec_sad_entry_add_del_v3_t::entry
vl_api_ipsec_sad_entry_v3_t entry
Definition: ipsec.api:212
vl_api_ipsec_tunnel_protect_del_t_handler
static void vl_api_ipsec_tunnel_protect_del_t_handler(vl_api_ipsec_tunnel_protect_del_t *mp)
Definition: ipsec_api.c:103
vl_api_ipsec_spd_interface_details_t
IPsec: SPD interface response.
Definition: ipsec.api:355
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
vl_api_ipsec_spd_dump_t::sa_id
u32 sa_id
Definition: ipsec.api:173
vl_api_ipsec_sa_dump_t_handler
static void vl_api_ipsec_sa_dump_t_handler(vl_api_ipsec_sa_dump_t *mp)
Definition: ipsec_api.c:846
ipsec_sa_t::seq
u32 seq
Definition: ipsec_sa.h:132
ipsec_sa_dump_match_ctx_t_::sai
index_t sai
Definition: ipsec_api.c:748
ipsec_api_hookup
static clib_error_t * ipsec_api_hookup(vlib_main_t *vm)
Definition: ipsec_api.c:1121
vl_api_ipsec_sa_v2_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:462
vl_api_ipsec_itf_create_t
Create an IPSec interface.
Definition: ipsec.api:370
ip_dscp_decode
ip_dscp_t ip_dscp_decode(vl_api_ip_dscp_t in)
Definition: ip_types_api.c:85
ipsec_tun_protect_update
int ipsec_tun_protect_update(u32 sw_if_index, const ip_address_t *nh, u32 sa_out, u32 *sas_in)
Definition: ipsec_tun.c:564
vl_api_ipsec_spds_details_t
Dump IPsec all SPD IDs response.
Definition: ipsec.api:157
uword
u64 uword
Definition: types.h:112
ipsec_main
ipsec_main_t ipsec_main
Definition: ipsec.c:29
ipsec_spd_action_encode
vl_api_ipsec_spd_action_t ipsec_spd_action_encode(ipsec_policy_action_t in)
Definition: ipsec_api.c:547
vl_api_ipsec_sa_v3_details_t::context
u32 context
Definition: ipsec.api:471
ipsec_tun_protect_t_::itp_out_sa
index_t itp_out_sa
Definition: ipsec_tun.h:110
vl_api_ipsec_itf_details_t::context
u32 context
Definition: ipsec.api:404
vl_api_ipsec_spd_entry_add_del_reply_t::stat_index
u32 stat_index
Definition: ipsec.api:140
vl_api_ipsec_sa_v2_dump_t::client_index
u32 client_index
Definition: ipsec.api:422
interface.h
send_ipsec_sa_v2_details
static walk_rc_t send_ipsec_sa_v2_details(ipsec_sa_t *sa, void *arg)
Definition: ipsec_api.c:863
ipsec_key_t_
Definition: ipsec_sa.h:80
vl_api_ipsec_sad_entry_add_t
Definition: ipsec.api:214
vl_api_ipsec_backend_dump_t::client_index
u32 client_index
Definition: ipsec.api:487
nh
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
vl_api_ipsec_sa_dump_t::context
u32 context
Definition: ipsec.api:417
vl_api_ipsec_itf_delete_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:392
ipsec_dump_walk_ctx_t
struct ipsec_dump_walk_ctx_t_ ipsec_dump_walk_ctx_t
vl_api_ipsec_sa_details_t::seq_outbound
u64 seq_outbound
Definition: ipsec.api:452
IP46_TYPE_IP6
@ IP46_TYPE_IP6
Definition: ip46_address.h:27
vl_api_ipsec_spd_interface_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:358
vl_api_ipsec_spd_dump_t::context
u32 context
Definition: ipsec.api:171
vl_api_ipsec_sad_entry_add_del_v3_t_handler
static void vl_api_ipsec_sad_entry_add_del_v3_t_handler(vl_api_ipsec_sad_entry_add_del_v3_t *mp)
Definition: ipsec_api.c:463
ipsec_policy_t_::sa_id
u32 sa_id
Definition: ipsec_spd_policy.h:72
vl_api_ipsec_backend_details_t::context
u32 context
Definition: ipsec.api:498
vl_api_ipsec_tunnel_protect_del_t
Definition: ipsec.api:311
ipsec_sa_t::crypto_alg
ipsec_crypto_alg_t crypto_alg
Definition: ipsec_sa.h:215
vl_api_ipsec_backend_details_t::active
bool active
Definition: ipsec.api:502
vl_api_ipsec_sad_entry_add_del_v3_t::is_add
bool is_add
Definition: ipsec.api:211
vl_api_ipsec_sad_entry_add_reply_t
Definition: ipsec.api:246
vl_api_ipsec_spd_interface_dump_t_handler
static void vl_api_ipsec_spd_interface_dump_t_handler(vl_api_ipsec_spd_interface_dump_t *mp)
Definition: ipsec_api.c:649
vl_api_ipsec_select_backend_t
Select IPsec backend.
Definition: ipsec.api:511
vl_api_ipsec_sa_v3_dump_t
Definition: ipsec.api:426
ip_address_decode2
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
Definition: ip_types_api.c:178
vl_api_ipsec_tunnel_protect_details_t::context
u32 context
Definition: ipsec.api:332
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
vl_api_ipsec_backend_details_t::protocol
vl_api_ipsec_proto_t protocol
Definition: ipsec.api:500
vl_api_ipsec_tunnel_protect_update_t
Definition: ipsec.api:303
vl_api_ipsec_spds_details_t::context
u32 context
Definition: ipsec.api:158
ipsec_sa_t
Definition: ipsec_sa.h:116
vl_api_ipsec_interface_add_del_spd_t_handler
static void vl_api_ipsec_interface_add_del_spd_t_handler(vl_api_ipsec_interface_add_del_spd_t *mp)
Definition: ipsec_api.c:56
vl_api_ipsec_spd_dump_t::client_index
u32 client_index
Definition: ipsec.api:170
id
u8 id[64]
Definition: dhcp.api:160
vl_api_ipsec_sad_entry_add_del_v2_t::is_add
bool is_add
Definition: ipsec.api:204
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(ipsec_api_hookup)
vl_api_ipsec_spds_dump_t::client_index
u32 client_index
Definition: ipsec.api:148
vl_api_ipsec_spd_add_del_t_handler
static void vl_api_ipsec_spd_add_del_t_handler(vl_api_ipsec_spd_add_del_t *mp)
Definition: ipsec_api.c:44
vl_api_ipsec_sa_details_t::entry
vl_api_ipsec_sad_entry_t entry
Definition: ipsec.api:448
ip46_address_range_t::start
ip46_address_t start
Definition: ipsec_spd_policy.h:37
vl_api_ipsec_sad_entry_add_del_v2_t::entry
vl_api_ipsec_sad_entry_v2_t entry
Definition: ipsec.api:205
vl_api_ipsec_tunnel_protect_update_t::tunnel
vl_api_ipsec_tunnel_protect_t tunnel
Definition: ipsec.api:308
vl_api_ipsec_spd_entry_add_del_t_handler
static void vl_api_ipsec_spd_entry_add_del_t_handler(vl_api_ipsec_spd_entry_add_del_t *mp)
Definition: ipsec_api.c:211
ipsec_policy_t_::rport
port_range_t rport
Definition: ipsec_spd_policy.h:68
vl_api_ipsec_sad_entry_add_t_handler
static void vl_api_ipsec_sad_entry_add_t_handler(vl_api_ipsec_sad_entry_add_t *mp)
Definition: ipsec_api.c:497
vl_api_ipsec_sa_v3_dump_t::context
u32 context
Definition: ipsec.api:429
vl_api_ipsec_tunnel_protect_dump_t_handler
static void vl_api_ipsec_tunnel_protect_dump_t_handler(vl_api_ipsec_tunnel_protect_dump_t *mp)
Definition: ipsec_api.c:165
spi
u32 spi
Definition: flow_types.api:140
format_fns.h
u64
unsigned long u64
Definition: types.h:89
vl_api_ipsec_backend_details_t
IPsec backend details.
Definition: ipsec.api:497
vl_api_ipsec_itf_delete_t_handler
static void vl_api_ipsec_itf_delete_t_handler(vl_api_ipsec_itf_delete_t *mp)
Definition: ipsec_api.c:700
IPSEC_API_SPD_ACTION_BYPASS
@ IPSEC_API_SPD_ACTION_BYPASS
Definition: ipsec.api:64
send_ipsec_itf_details
static walk_rc_t send_ipsec_itf_details(ipsec_itf_t *itf, void *arg)
Definition: ipsec_api.c:711
tunnel_encode
void tunnel_encode(const tunnel_t *in, vl_api_tunnel_t *out)
Definition: tunnel_types_api.c:147
vl_api_ipsec_sad_entry_add_del_v2_reply_t::stat_index
u32 stat_index
Definition: ipsec.api:238
ip.h
vl_api_ipsec_spd_dump_t
Dump ipsec policy database data.
Definition: ipsec.api:169
u32
unsigned int u32
Definition: types.h:88
vl_api_ipsec_backend_details_t::index
u8 index
Definition: ipsec.api:501
vl_api_ipsec_spd_entry_add_del_t::entry
vl_api_ipsec_spd_entry_t entry
Definition: ipsec.api:127
vl_api_ipsec_sa_v2_dump_t::context
u32 context
Definition: ipsec.api:423
udp_header_t::dst_port
u16 dst_port
Definition: udp_packet.h:48
integ_alg
u8 integ_alg
Definition: ikev2_types.api:59
ipsec_policy_t_
A Secruity Policy.
Definition: ipsec_spd_policy.h:54
protocol
vl_api_ip_proto_t protocol
Definition: lb_types.api:72
ipsec_tun_protect_del
int ipsec_tun_protect_del(u32 sw_if_index, const ip_address_t *nh)
Definition: ipsec_tun.c:714
IPSEC_API_PROTO_AH
@ IPSEC_API_PROTO_AH
Definition: ipsec_types.api:87
tunnel_t_::t_dst
ip_address_t t_dst
Definition: tunnel.h:88
ipsec_proto_decode
int ipsec_proto_decode(vl_api_ipsec_proto_t in, ipsec_protocol_t *out)
Encode/decode function from/to API to internal types.
Definition: ipsec_types_api.c:21
ipsec_esp_backend_t
Definition: ipsec.h:54
vl_api_ipsec_sa_details_t::replay_window
u64 replay_window
Definition: ipsec.api:454
ipsec_add_del_policy
int ipsec_add_del_policy(vlib_main_t *vm, ipsec_policy_t *policy, int is_add, u32 *stat_index)
Add/Delete a SPD.
Definition: ipsec_spd_policy.c:140
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
send_ipsec_spd_details
static void send_ipsec_spd_details(ipsec_policy_t *p, vl_api_registration_t *reg, u32 context)
Definition: ipsec_api.c:563
ipsec_set_async_mode
void ipsec_set_async_mode(u32 is_enabled)
Definition: ipsec.c:328
vl_api_ipsec_sad_entry_add_del_reply_t
Definition: ipsec.api:227
api_helper_macros.h
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
ipsec_spd_t
A Secruity Policy Database.
Definition: ipsec_spd.h:46
IPSEC_PROTOCOL_AH
@ IPSEC_PROTOCOL_AH
Definition: ipsec_sa.h:75
vl_api_ipsec_select_backend_t::index
u8 index
Definition: ipsec.api:515
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
ipsec_sa_t::salt
u32 salt
Definition: ipsec_sa.h:172
tunnel_t_::t_table_id
u32 t_table_id
Definition: tunnel.h:92
ipsec_sa_t::seq_hi
u32 seq_hi
Definition: ipsec_sa.h:133
ipsec_tun_protect_t_::itp_key
ip_address_t * itp_key
Definition: ipsec_tun.h:126
port_range_t::start
u16 start
Definition: ipsec_spd_policy.h:42
ipsec_sad_flags_encode
vl_api_ipsec_sad_flags_t ipsec_sad_flags_encode(const ipsec_sa_t *sa)
Definition: ipsec_types_api.c:153
ipsec_policy_t_::lport
port_range_t lport
Definition: ipsec_spd_policy.h:67
vl_api_ipsec_sa_v2_dump_t_handler
static void vl_api_ipsec_sa_v2_dump_t_handler(vl_api_ipsec_sa_v2_dump_t *mp)
Definition: ipsec_api.c:933
ipsec_sa_dump_match_ctx_t_
Definition: ipsec_api.c:746
vl_api_ipsec_select_backend_t::protocol
vl_api_ipsec_proto_t protocol
Definition: ipsec.api:514
ipsec_sa_t::id
u32 id
Definition: ipsec_sa.h:209
vl_api_ipsec_itf_create_t::itf
vl_api_ipsec_itf_t itf
Definition: ipsec.api:373
vl_api_ipsec_sad_entry_del_t
Definition: ipsec.api:220
vl_api_ipsec_spd_interface_dump_t::spd_index_valid
u8 spd_index_valid
Definition: ipsec.api:347
ipsec_policy_t_::type
ipsec_spd_policy_type_t type
Definition: ipsec_spd_policy.h:60
tunnel_mode_t
enum tunnel_mode_t_ tunnel_mode_t
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_ipsec_itf_create_t_handler
static void vl_api_ipsec_itf_create_t_handler(vl_api_ipsec_itf_create_t *mp)
Definition: ipsec_api.c:679
vl_api_ipsec_itf_dump_t::client_index
u32 client_index
Definition: ipsec.api:397
REPLY_MSG_ID_BASE
#define REPLY_MSG_ID_BASE
Definition: ipsec_api.c:40
vl_api_ipsec_sad_entry_add_del_v2_t_handler
static void vl_api_ipsec_sad_entry_add_del_v2_t_handler(vl_api_ipsec_sad_entry_add_del_v2_t *mp)
Definition: ipsec_api.c:339
ip_address_encode
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
Definition: ip_types_api.c:206
ipsec_types_api.h
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
vl_api_ipsec_itf_delete_t
Definition: ipsec.api:388
ipsec_policy_t_::laddr
ip46_address_range_t laddr
Definition: ipsec_spd_policy.h:64
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vl_api_ipsec_sad_entry_add_t::entry
vl_api_ipsec_sad_entry_v3_t entry
Definition: ipsec.api:218
IPSEC_API_PROTO_ESP
@ IPSEC_API_PROTO_ESP
Definition: ipsec_types.api:86
vl_api_ipsec_sad_entry_add_del_t_handler
static void vl_api_ipsec_sad_entry_add_del_t_handler(vl_api_ipsec_sad_entry_add_del_t *mp)
Definition: ipsec_api.c:274
ipsec_policy_t_::id
u32 id
Definition: ipsec_spd_policy.h:56
tunnel_t_::t_encap_decap_flags
tunnel_encap_decap_flags_t t_encap_decap_flags
Definition: tunnel.h:89
ip46_type_t
ip46_type_t
Definition: ip46_address.h:22
ipsec_select_esp_backend
int ipsec_select_esp_backend(ipsec_main_t *im, u32 backend_idx)
Definition: ipsec.c:281
ipsec_select_ah_backend
int ipsec_select_ah_backend(ipsec_main_t *im, u32 backend_idx)
Definition: ipsec.c:258
ipsec_sa_t::integ_alg
ipsec_integ_alg_t integ_alg
Definition: ipsec_sa.h:216
tunnel_encap_decap_flags_encode
vl_api_tunnel_encap_decap_flags_t tunnel_encap_decap_flags_encode(tunnel_encap_decap_flags_t f)
Definition: tunnel_types_api.c:46
ipsec_ah_backend_t::name
u8 * name
Definition: ipsec.h:39
clib_warning
#define clib_warning(format, args...)
Definition: error.h:59
ipip.h
ipsec_spd_t::policies
u32 * policies[IPSEC_SPD_POLICY_N_TYPES]
vectors for each of the policy types
Definition: ipsec_spd.h:51
vl_api_ipsec_itf_dump_t::context
u32 context
Definition: ipsec.api:398
vl_api_ipsec_itf_details_t
Definition: ipsec.api:402
context
u32 context
Definition: ip.api:852
vl_api_ipsec_sa_details_t
IPsec security association database response.
Definition: ipsec.api:445
tunnel_mode_decode
int tunnel_mode_decode(vl_api_tunnel_mode_t in, tunnel_mode_t *out)
Definition: tunnel_types_api.c:69
vl_api_ipsec_tunnel_protect_dump_t
Dump all tunnel protections.
Definition: ipsec.api:323
ipsec_itf_walk
void ipsec_itf_walk(ipsec_itf_walk_cb_t cb, void *ctx)
Definition: ipsec_itf.c:346
FOR_EACH_IPSEC_PROTECT_INPUT_SA
#define FOR_EACH_IPSEC_PROTECT_INPUT_SA(_itp, _sa, body)
Definition: ipsec_tun.h:138
rv
int __clib_unused rv
Definition: application.c:491
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
vl_api_ipsec_interface_add_del_spd_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:56
vl_api_ipsec_spd_interface_details_t::spd_index
u32 spd_index
Definition: ipsec.api:357
ipsec_itf_delete
int ipsec_itf_delete(u32 sw_if_index)
Definition: ipsec_itf.c:320
ipsec_sa_t::stat_index
u32 stat_index
Definition: ipsec_sa.h:210
tunnel_decode
int tunnel_decode(const vl_api_tunnel_t *in, tunnel_t *out)
Definition: tunnel_types_api.c:103
vl_api_ipsec_spd_interface_dump_t::client_index
u32 client_index
Definition: ipsec.api:344
vl_api_ipsec_spds_dump_t_handler
static void vl_api_ipsec_spds_dump_t_handler(vl_api_ipsec_spds_dump_t *mp)
Definition: ipsec_api.c:531
ipsec_sa_add_and_lock
int ipsec_sa_add_and_lock(u32 id, u32 spi, ipsec_protocol_t proto, ipsec_crypto_alg_t crypto_alg, const ipsec_key_t *ck, ipsec_integ_alg_t integ_alg, const ipsec_key_t *ik, ipsec_sa_flags_t flags, u32 salt, u16 src_port, u16 dst_port, const tunnel_t *tun, u32 *sa_out_index)
Definition: ipsec_sa.c:170
vnet.h
api_errno.h
vl_api_ipsec_tunnel_protect_dump_t::client_index
u32 client_index
Definition: ipsec.api:325
vl_api_ipsec_sa_v3_dump_t::client_index
u32 client_index
Definition: ipsec.api:428
ipsec_spd_policy_type_t
enum ipsec_spd_policy_t_ ipsec_spd_policy_type_t
vl_api_ipsec_sa_v2_details_t::context
u32 context
Definition: ipsec.api:459
ipsec_tun_protect_get
static ipsec_tun_protect_t * ipsec_tun_protect_get(u32 index)
Definition: ipsec_tun.h:175
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
ipsec_policy_t_::policy
ipsec_policy_action_t policy
Definition: ipsec_spd_policy.h:71
send_ipsec_sa_v3_details
static walk_rc_t send_ipsec_sa_v3_details(ipsec_sa_t *sa, void *arg)
Definition: ipsec_api.c:950
ipsec_crypto_algo_encode
vl_api_ipsec_crypto_alg_t ipsec_crypto_algo_encode(ipsec_crypto_alg_t c)
Definition: ipsec_types_api.c:68
vl_api_ipsec_sad_entry_add_del_v2_t
Definition: ipsec.api:200
ipsec_tun_protect_walk_itf
void ipsec_tun_protect_walk_itf(u32 sw_if_index, ipsec_tun_protect_walk_cb_t fn, void *ctx)
Definition: ipsec_tun.c:759
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
tun
vl_api_gbp_endpoint_tun_t tun
Definition: gbp.api:134
vl_api_ipsec_spds_details_t::spd_id
u32 spd_id
Definition: ipsec.api:159
ip_types_api.h
send_ipsec_tunnel_protect_details
static walk_rc_t send_ipsec_tunnel_protect_details(index_t itpi, void *arg)
Definition: ipsec_api.c:130
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
vl_api_ipsec_spds_dump_t::context
u32 context
Definition: ipsec.api:149
ipsec_sa_unlock_id
int ipsec_sa_unlock_id(u32 id)
Definition: ipsec_sa.c:406
ipsec_sa_t::spi
u32 spi
Definition: ipsec_sa.h:131
ipsec_sad_entry_add_v3
static int ipsec_sad_entry_add_v3(const vl_api_ipsec_sad_entry_v3_t *entry, u32 *sa_index)
Definition: ipsec_api.c:413
ipsec_crypto_algo_decode
int ipsec_crypto_algo_decode(vl_api_ipsec_crypto_alg_t in, ipsec_crypto_alg_t *out)
Definition: ipsec_types_api.c:51
vl_api_ipsec_sad_entry_add_del_t::entry
vl_api_ipsec_sad_entry_t entry
Definition: ipsec.api:198
vl_api_ipsec_tunnel_protect_update_t_handler
static void vl_api_ipsec_tunnel_protect_update_t_handler(vl_api_ipsec_tunnel_protect_update_t *mp)
Definition: ipsec_api.c:77
ipsec_sa_pool
ipsec_sa_t * ipsec_sa_pool
Pool of IPSec SAs.
Definition: ipsec_sa.c:32
WALK_STOP
@ WALK_STOP
Definition: interface_funcs.h:173
ipsec_tun_protect_walk
void ipsec_tun_protect_walk(ipsec_tun_protect_walk_cb_t fn, void *ctx)
Definition: ipsec_tun.c:746
vl_api_ipsec_sad_entry_add_del_reply_t::stat_index
u32 stat_index
Definition: ipsec.api:232
ipsec_tun_protect_t_::itp_n_sa_in
u32 itp_n_sa_in
Definition: ipsec_tun.h:114
ipsec_integ_algo_encode
vl_api_ipsec_integ_alg_t ipsec_integ_algo_encode(ipsec_integ_alg_t i)
Definition: ipsec_types_api.c:100
vl_api_ipsec_interface_add_del_spd_t::is_add
bool is_add
Definition: ipsec.api:55
vl_api_ipsec_sa_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ipsec.api:450
ipsec_sa_flags_decode
ipsec_sa_flags_t ipsec_sa_flags_decode(vl_api_ipsec_sad_flags_t in)
Definition: ipsec_types_api.c:129
vl_api_ipsec_set_async_mode_t::async_enable
bool async_enable
Definition: ipsec.api:527
vl_api_ipsec_sad_entry_del_t_handler
static void vl_api_ipsec_sad_entry_del_t_handler(vl_api_ipsec_sad_entry_del_t *mp)
Definition: ipsec_api.c:486
ipsec_policy_t_::protocol
u8 protocol
Definition: ipsec_spd_policy.h:66
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_ipsec_sa_v2_details_t::replay_window
u64 replay_window
Definition: ipsec.api:466
vl_api_ipsec_spd_interface_dump_t
IPsec: Get SPD interfaces.
Definition: ipsec.api:343
vl_api_ipsec_sa_v2_details_t
Definition: ipsec.api:458
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
vl_api_ipsec_set_async_mode_t_handler
static void vl_api_ipsec_set_async_mode_t_handler(vl_api_ipsec_set_async_mode_t *mp)
Definition: ipsec_api.c:1109