FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
ikev2_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 #include <vnet/api_errno.h>
23 #include <vpp/app/version.h>
24 #include <vnet/ip/ip_types_api.h>
25 #include <ikev2/ikev2.h>
26 #include <ikev2/ikev2_priv.h>
27 
28 /* define message IDs */
29 #include <vnet/format_fns.h>
30 #include <plugins/ikev2/ikev2.api_enum.h>
31 #include <plugins/ikev2/ikev2.api_types.h>
32 
33 
34 #define vl_endianfun /* define message structures */
35 #include <plugins/ikev2/ikev2.api.h>
36 #include <plugins/ikev2/ikev2_types.api.h>
37 #undef vl_endianfun
38 
40 
41 #define IKEV2_PLUGIN_VERSION_MAJOR 1
42 #define IKEV2_PLUGIN_VERSION_MINOR 0
43 #define REPLY_MSG_ID_BASE ikev2_main.msg_id_base
45 
46 #define IKEV2_MAX_DATA_LEN (1 << 10)
47 
48 static u32
50 {
51  return (ti << 16) | sai;
52 }
53 
54 static void
55 ikev2_decode_sa_index (u32 api_sai, u32 * sai, u32 * ti)
56 {
57  *sai = api_sai & 0xffff;
58  *ti = api_sai >> 16;
59 }
60 
61 static void
62 cp_ike_transforms (vl_api_ikev2_ike_transforms_t * vl_api_ts,
64 {
65  vl_api_ts->crypto_alg = ts->crypto_alg;
66  vl_api_ts->integ_alg = ts->integ_alg;
67  vl_api_ts->dh_group = ts->dh_type;
68  vl_api_ts->crypto_key_size = ts->crypto_key_size;
69 }
70 
71 static void
72 cp_esp_transforms (vl_api_ikev2_esp_transforms_t * vl_api_ts,
74 {
75  vl_api_ts->crypto_alg = ts->crypto_alg;
76  vl_api_ts->integ_alg = ts->integ_alg;
77  vl_api_ts->crypto_key_size = ts->crypto_key_size;
78 }
79 
80 static void
81 cp_id (vl_api_ikev2_id_t * vl_api_id, ikev2_id_t * id)
82 {
83  if (!id->data)
84  return;
85 
86  int size_data = 0;
87  vl_api_id->type = id->type;
88  size_data = sizeof (vl_api_id->data) - 1; // size without zero ending character
89  if (vec_len (id->data) < size_data)
90  size_data = vec_len (id->data);
91 
92  vl_api_id->data_len = size_data;
93  clib_memcpy (vl_api_id->data, id->data, size_data);
94 }
95 
96 static void
97 cp_ts (vl_api_ikev2_ts_t * vl_api_ts, ikev2_ts_t * ts, u8 is_local)
98 {
99  vl_api_ts->is_local = is_local;
100  vl_api_ts->protocol_id = ts->protocol_id;
101  vl_api_ts->start_port = ts->start_port;
102  vl_api_ts->end_port = ts->end_port;
103  ip_address_encode2 (&ts->start_addr, &vl_api_ts->start_addr);
104  ip_address_encode2 (&ts->end_addr, &vl_api_ts->end_addr);
105 }
106 
107 static void
108 cp_auth (vl_api_ikev2_auth_t * vl_api_auth, ikev2_auth_t * auth)
109 {
110  vl_api_auth->method = auth->method;
111  vl_api_auth->data_len = vec_len (auth->data);
112  vl_api_auth->hex = auth->hex;
113  clib_memcpy (&vl_api_auth->data, auth->data, vec_len (auth->data));
114 }
115 
116 static void
117 cp_responder (vl_api_ikev2_responder_t * vl_api_responder,
119 {
120  vl_api_responder->sw_if_index = responder->sw_if_index;
121  ip_address_encode2 (&responder->addr, &vl_api_responder->addr);
122 }
123 
124 void
125 cp_sa_transform (vl_api_ikev2_sa_transform_t * vl_tr,
127 {
128  vl_tr->transform_type = tr->type;
129  vl_tr->key_len = tr->key_len;
130  vl_tr->key_trunc = tr->key_trunc;
131  vl_tr->block_size = tr->block_size;
132  vl_tr->dh_group = tr->dh_group;
133  vl_tr->transform_id = tr->encr_type;
134 }
135 
136 static void
138  u32 context)
139 {
141 
142  rmp = vl_msg_api_alloc (sizeof (*rmp) + vec_len (profile->auth.data));
143  clib_memset (rmp, 0, sizeof (*rmp) + vec_len (profile->auth.data));
145  rmp->_vl_msg_id = ntohs (VL_API_IKEV2_PROFILE_DETAILS + im->msg_id_base);
146  rmp->context = context;
147 
148  int size_data = sizeof (rmp->profile.name) - 1;
149  if (vec_len (profile->name) < size_data)
150  size_data = vec_len (profile->name);
151  clib_memcpy (rmp->profile.name, profile->name, size_data);
152 
153  cp_ike_transforms (&rmp->profile.ike_ts, &profile->ike_ts);
154  cp_esp_transforms (&rmp->profile.esp_ts, &profile->esp_ts);
155 
156  cp_id (&rmp->profile.loc_id, &profile->loc_id);
157  cp_id (&rmp->profile.rem_id, &profile->rem_id);
158 
159  cp_ts (&rmp->profile.rem_ts, &profile->rem_ts, 0 /* is_local */ );
160  cp_ts (&rmp->profile.loc_ts, &profile->loc_ts, 1 /* is_local */ );
161 
162  cp_auth (&rmp->profile.auth, &profile->auth);
163 
164  cp_responder (&rmp->profile.responder, &profile->responder);
165 
166  rmp->profile.udp_encap = profile->udp_encap;
167  rmp->profile.tun_itf = profile->tun_itf;
168  rmp->profile.natt_disabled = profile->natt_disabled;
169  rmp->profile.ipsec_over_udp_port = profile->ipsec_over_udp_port;
170 
171  rmp->profile.lifetime = profile->lifetime;
172  rmp->profile.lifetime_maxdata = profile->lifetime_maxdata;
173  rmp->profile.lifetime_jitter = profile->lifetime_jitter;
174  rmp->profile.handover = profile->handover;
175 
176  vl_api_ikev2_profile_t_endian (&rmp->profile);
177 
178  vl_api_send_msg (reg, (u8 *) rmp);
179 }
180 
181 static void
183 {
185  ikev2_profile_t *profile;
188  if (!reg)
189  return;
190 
191  /* *INDENT-OFF* */
192  pool_foreach (profile, im->profiles)
193  {
194  send_profile (profile, reg, mp->context);
195  }
196  /* *INDENT-ON* */
197 }
198 
199 static void
200 ikev2_copy_stats (vl_api_ikev2_sa_stats_t *dst, const ikev2_stats_t *src)
201 {
202  dst->n_rekey_req = src->n_rekey_req;
203  dst->n_keepalives = src->n_keepalives;
204  dst->n_retransmit = src->n_retransmit;
205  dst->n_init_sa_retransmit = src->n_init_retransmit;
206  dst->n_sa_init_req = src->n_sa_init_req;
207  dst->n_sa_auth_req = src->n_sa_auth_req;
208 }
209 
210 static void
211 send_sa (ikev2_sa_t * sa, vl_api_ikev2_sa_dump_t * mp, u32 api_sa_index)
212 {
213  vl_api_ikev2_sa_details_t *rmp = 0;
214  int rv = 0;
216 
217  /* *INDENT-OFF* */
218  REPLY_MACRO2_ZERO (VL_API_IKEV2_SA_DETAILS,
219  {
220  vl_api_ikev2_sa_t *rsa = &rmp->sa;
221  vl_api_ikev2_keys_t* k = &rsa->keys;
222  rsa->profile_index = rsa->profile_index;
223  rsa->sa_index = api_sa_index;
224  ip_address_encode2 (&sa->iaddr, &rsa->iaddr);
225  ip_address_encode2 (&sa->raddr, &rsa->raddr);
226  rsa->ispi = sa->ispi;
227  rsa->rspi = sa->rspi;
228  cp_id(&rsa->i_id, &sa->i_id);
229  cp_id(&rsa->r_id, &sa->r_id);
230 
231  tr = ikev2_sa_get_td_for_type (sa->r_proposals, IKEV2_TRANSFORM_TYPE_ENCR);
232  if (tr)
233  cp_sa_transform (&rsa->encryption, tr);
234 
235  tr = ikev2_sa_get_td_for_type (sa->r_proposals, IKEV2_TRANSFORM_TYPE_PRF);
236  if (tr)
237  cp_sa_transform (&rsa->prf, tr);
238 
240  IKEV2_TRANSFORM_TYPE_INTEG);
241  if (tr)
242  cp_sa_transform (&rsa->integrity, tr);
243 
244  tr = ikev2_sa_get_td_for_type (sa->r_proposals, IKEV2_TRANSFORM_TYPE_DH);
245  if (tr)
246  cp_sa_transform (&rsa->dh, tr);
247 
248  k->sk_d_len = vec_len (sa->sk_d);
249  clib_memcpy (&k->sk_d, sa->sk_d, k->sk_d_len);
250 
251  k->sk_ai_len = vec_len (sa->sk_ai);
252  clib_memcpy (&k->sk_ai, sa->sk_ai, k->sk_ai_len);
253 
254  k->sk_ar_len = vec_len (sa->sk_ar);
255  clib_memcpy (&k->sk_ar, sa->sk_ar, k->sk_ar_len);
256 
257  k->sk_ei_len = vec_len (sa->sk_ei);
258  clib_memcpy (&k->sk_ei, sa->sk_ei, k->sk_ei_len);
259 
260  k->sk_er_len = vec_len (sa->sk_er);
261  clib_memcpy (&k->sk_er, sa->sk_er, k->sk_er_len);
262 
263  k->sk_pi_len = vec_len (sa->sk_pi);
264  clib_memcpy (&k->sk_pi, sa->sk_pi, k->sk_pi_len);
265 
266  k->sk_pr_len = vec_len (sa->sk_pr);
267  clib_memcpy (&k->sk_pr, sa->sk_pr, k->sk_pr_len);
268 
269  ikev2_copy_stats (&rsa->stats, &sa->stats);
270 
271  vl_api_ikev2_sa_t_endian(rsa);
272  });
273  /* *INDENT-ON* */
274 }
275 
276 static void
278 {
279  ikev2_main_t *km = &ikev2_main;
281  ikev2_sa_t *sa;
282 
283  vec_foreach (tkm, km->per_thread_data)
284  {
285  /* *INDENT-OFF* */
286  pool_foreach (sa, tkm->sas)
287  {
288  u32 api_sa_index = ikev2_encode_sa_index (sa - tkm->sas,
289  tkm - km->per_thread_data);
290  send_sa (sa, mp, api_sa_index);
291  }
292  /* *INDENT-ON* */
293  }
294 }
295 
296 
297 static void
300  u32 sa_index)
301 {
303  int rv = 0;
305 
306  /* *INDENT-OFF* */
307  REPLY_MACRO2_ZERO (VL_API_IKEV2_CHILD_SA_DETAILS,
308  {
309  vl_api_ikev2_keys_t *k = &rmp->child_sa.keys;
310  rmp->child_sa.child_sa_index = child_sa_index;
311  rmp->child_sa.sa_index = sa_index;
312  rmp->child_sa.i_spi =
313  child->i_proposals ? child->i_proposals[0].spi : 0;
314  rmp->child_sa.r_spi =
315  child->r_proposals ? child->r_proposals[0].spi : 0;
316 
318  IKEV2_TRANSFORM_TYPE_ENCR);
319  if (tr)
320  cp_sa_transform (&rmp->child_sa.encryption, tr);
321 
323  IKEV2_TRANSFORM_TYPE_INTEG);
324  if (tr)
325  cp_sa_transform (&rmp->child_sa.integrity, tr);
326 
328  IKEV2_TRANSFORM_TYPE_ESN);
329  if (tr)
330  cp_sa_transform (&rmp->child_sa.esn, tr);
331 
332  k->sk_ei_len = vec_len (child->sk_ei);
333  clib_memcpy (&k->sk_ei, child->sk_ei, k->sk_ei_len);
334 
335  k->sk_er_len = vec_len (child->sk_er);
336  clib_memcpy (&k->sk_er, child->sk_er, k->sk_er_len);
337 
338  if (vec_len (child->sk_ai))
339  {
340  k->sk_ai_len = vec_len (child->sk_ai);
341  clib_memcpy (&k->sk_ai, child->sk_ai,
342  k->sk_ai_len);
343 
344  k->sk_ar_len = vec_len (child->sk_ar);
345  clib_memcpy (&k->sk_ar, child->sk_ar,
346  k->sk_ar_len);
347  }
348 
349  vl_api_ikev2_child_sa_t_endian (&rmp->child_sa);
350  });
351  /* *INDENT-ON* */
352 }
353 
354 static void
356 {
359  ikev2_sa_t *sa;
360  ikev2_child_sa_t *child;
361  u32 sai = ~0, ti = ~0;
362 
363  ikev2_decode_sa_index (clib_net_to_host_u32 (mp->sa_index), &sai, &ti);
364 
365  if (vec_len (im->per_thread_data) <= ti)
366  return;
367 
369 
370  if (pool_len (tkm->sas) <= sai || pool_is_free_index (tkm->sas, sai))
371  return;
372 
373  sa = pool_elt_at_index (tkm->sas, sai);
374 
375  vec_foreach (child, sa->childs)
376  {
377  u32 child_sa_index = child - sa->childs;
378  send_child_sa (child, mp, child_sa_index, sai);
379  }
380 }
381 
382 static void
385 {
388  ikev2_sa_t *sa;
389  ikev2_child_sa_t *child;
390  ikev2_ts_t *ts;
391  u32 sai = ~0, ti = ~0;
392 
393  u32 api_sa_index = clib_net_to_host_u32 (mp->sa_index);
394  u32 child_sa_index = clib_net_to_host_u32 (mp->child_sa_index);
395  ikev2_decode_sa_index (api_sa_index, &sai, &ti);
396 
397  if (vec_len (im->per_thread_data) <= ti)
398  return;
399 
401 
402  if (pool_len (tkm->sas) <= sai || pool_is_free_index (tkm->sas, sai))
403  return;
404 
405  sa = pool_elt_at_index (tkm->sas, sai);
406 
407  if (vec_len (sa->childs) <= child_sa_index)
408  return;
409 
410  child = vec_elt_at_index (sa->childs, child_sa_index);
411 
412  vec_foreach (ts, mp->is_initiator ? child->tsi : child->tsr)
413  {
415  int rv = 0;
416 
417  /* *INDENT-OFF* */
418  REPLY_MACRO2_ZERO (VL_API_IKEV2_TRAFFIC_SELECTOR_DETAILS,
419  {
420  rmp->ts.sa_index = api_sa_index;
421  rmp->ts.child_sa_index = child_sa_index;
422  cp_ts (&rmp->ts, ts, mp->is_initiator);
423  vl_api_ikev2_ts_t_endian (&rmp->ts);
424  });
425  /* *INDENT-ON* */
426  }
427 }
428 
429 static void
431 {
434  ikev2_sa_t *sa;
435  u32 sai = ~0, ti = ~0;
436 
437  ikev2_decode_sa_index (clib_net_to_host_u32 (mp->sa_index), &sai, &ti);
438 
439  if (vec_len (im->per_thread_data) <= ti)
440  return;
441 
443 
444  if (pool_len (tkm->sas) <= sai || pool_is_free_index (tkm->sas, sai))
445  return;
446 
447  sa = pool_elt_at_index (tkm->sas, sai);
448 
449  u8 *nonce = mp->is_initiator ? sa->i_nonce : sa->r_nonce;
451  int data_len = vec_len (nonce);
452  int rv = 0;
453 
454  /* *INDENT-OFF* */
455  REPLY_MACRO3_ZERO (VL_API_IKEV2_NONCE_GET_REPLY, data_len,
456  {
457  rmp->data_len = clib_host_to_net_u32 (data_len);
458  clib_memcpy (rmp->nonce, nonce, data_len);
459  });
460  /* *INDENT-ON* */
461 }
462 
463 static void
465  mp)
466 {
469  int msg_size = sizeof (*rmp);
471 
473  if (!reg)
474  return;
475 
476  rmp = vl_msg_api_alloc (msg_size);
477  clib_memset (rmp, 0, msg_size);
478  rmp->_vl_msg_id =
479  ntohs (VL_API_IKEV2_PLUGIN_GET_VERSION_REPLY + im->msg_id_base);
480  rmp->context = mp->context;
481  rmp->major = htonl (IKEV2_PLUGIN_VERSION_MAJOR);
482  rmp->minor = htonl (IKEV2_PLUGIN_VERSION_MINOR);
483 
484  vl_api_send_msg (reg, (u8 *) rmp);
485 }
486 
487 static void
490 {
491  vl_api_ikev2_profile_set_liveness_reply_t *rmp;
492  int rv = 0;
493 
494 #if WITH_LIBSSL > 0
496  error = ikev2_set_liveness_params (clib_net_to_host_u32 (mp->period),
497  clib_net_to_host_u32 (mp->max_retries));
498  if (error)
499  {
502  rv = VNET_API_ERROR_UNSPECIFIED;
503  }
504 #else
505  rv = VNET_API_ERROR_UNIMPLEMENTED;
506 #endif
507 
508  REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_LIVENESS_REPLY);
509 }
510 
511 static void
513 {
514  vl_api_ikev2_profile_add_del_reply_t *rmp;
515  int rv = 0;
516 
517 #if WITH_LIBSSL > 0
520  u8 *tmp = format (0, "%s", mp->name);
522  vec_free (tmp);
523  if (error)
524  {
527  rv = VNET_API_ERROR_UNSPECIFIED;
528  }
529 #else
530  rv = VNET_API_ERROR_UNIMPLEMENTED;
531 #endif
532 
533  REPLY_MACRO (VL_API_IKEV2_PROFILE_ADD_DEL_REPLY);
534 }
535 
536 static void
539 {
540  vl_api_ikev2_profile_set_auth_reply_t *rmp;
541  int rv = 0;
542 
543 #if WITH_LIBSSL > 0
546  int data_len = ntohl (mp->data_len);
547  if (data_len > 0 && data_len <= IKEV2_MAX_DATA_LEN)
548  {
549  u8 *tmp = format (0, "%s", mp->name);
550  u8 *data = vec_new (u8, data_len);
551  clib_memcpy (data, mp->data, data_len);
552  error =
554  vec_free (tmp);
555  vec_free (data);
556  if (error)
557  {
560  rv = VNET_API_ERROR_UNSPECIFIED;
561  }
562  }
563  else
564  rv = VNET_API_ERROR_INVALID_VALUE;
565 #else
566  rv = VNET_API_ERROR_UNIMPLEMENTED;
567 #endif
568 
569  REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_AUTH_REPLY);
570 }
571 
572 static void
574 {
575  vl_api_ikev2_profile_set_id_reply_t *rmp;
576  int rv = 0;
577 
578 #if WITH_LIBSSL > 0
581  u8 *tmp = format (0, "%s", mp->name);
582  int data_len = ntohl (mp->data_len);
583  if (data_len > 0 && data_len <= IKEV2_MAX_DATA_LEN)
584  {
585  u8 *data = vec_new (u8, data_len);
586  clib_memcpy (data, mp->data, data_len);
588  vec_free (tmp);
589  vec_free (data);
590  if (error)
591  {
594  rv = VNET_API_ERROR_UNSPECIFIED;
595  }
596  }
597  else
598  rv = VNET_API_ERROR_INVALID_VALUE;
599 #else
600  rv = VNET_API_ERROR_UNIMPLEMENTED;
601 #endif
602 
603  REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_ID_REPLY);
604 }
605 
606 static void
609 {
610  vl_api_ikev2_profile_set_udp_encap_reply_t *rmp;
611  int rv = 0;
612 
613 #if WITH_LIBSSL > 0
616  u8 *tmp = format (0, "%s", mp->name);
618  vec_free (tmp);
619  if (error)
620  {
623  rv = VNET_API_ERROR_UNSPECIFIED;
624  }
625 #else
626  rv = VNET_API_ERROR_UNIMPLEMENTED;
627 #endif
628 
629  REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_UDP_ENCAP_REPLY);
630 }
631 
632 static void
634 {
635  vl_api_ikev2_profile_set_ts_reply_t *rmp;
636  int rv = 0;
637 
638 #if WITH_LIBSSL > 0
641  u8 *tmp = format (0, "%s", mp->name);
643  ip_address_decode2 (&mp->ts.start_addr, &start_addr);
644  ip_address_decode2 (&mp->ts.end_addr, &end_addr);
645  error =
646  ikev2_set_profile_ts (vm, tmp, mp->ts.protocol_id,
647  clib_net_to_host_u16 (mp->ts.start_port),
648  clib_net_to_host_u16 (mp->ts.end_port),
649  start_addr, end_addr, mp->ts.is_local);
650  vec_free (tmp);
651  if (error)
652  {
655  rv = VNET_API_ERROR_UNSPECIFIED;
656  }
657 #else
658  rv = VNET_API_ERROR_UNIMPLEMENTED;
659 #endif
660 
661  REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_TS_REPLY);
662 }
663 
664 static void
666 {
667  vl_api_ikev2_set_local_key_reply_t *rmp;
668  int rv = 0;
669 
670 #if WITH_LIBSSL > 0
673 
675  if (error)
676  {
679  rv = VNET_API_ERROR_UNSPECIFIED;
680  }
681 #else
682  rv = VNET_API_ERROR_UNIMPLEMENTED;
683 #endif
684 
685  REPLY_MACRO (VL_API_IKEV2_SET_LOCAL_KEY_REPLY);
686 }
687 
688 static void
691 {
692  vl_api_ikev2_set_responder_hostname_reply_t *rmp;
693  int rv = 0;
694 
695 #if WITH_LIBSSL > 0
698 
699  u8 *tmp = format (0, "%s", mp->name);
700  u8 *hn = format (0, "%s", mp->hostname);
701  u32 sw_if_index = clib_net_to_host_u32 (mp->sw_if_index);
702 
704  vec_free (tmp);
705  vec_free (hn);
706 
707  if (error)
708  {
711  rv = VNET_API_ERROR_UNSPECIFIED;
712  }
713 #else
714  rv = VNET_API_ERROR_UNIMPLEMENTED;
715 #endif
716 
717  REPLY_MACRO (VL_API_IKEV2_SET_RESPONDER_HOSTNAME_REPLY);
718 }
719 
720 static void
722 {
723  vl_api_ikev2_set_responder_reply_t *rmp;
724  int rv = 0;
725 
726 #if WITH_LIBSSL > 0
729 
730  u8 *tmp = format (0, "%s", mp->name);
732  ip_address_decode2 (&mp->responder.addr, &ip);
733  u32 sw_if_index = clib_net_to_host_u32 (mp->responder.sw_if_index);
734 
736  vec_free (tmp);
737  if (error)
738  {
741  rv = VNET_API_ERROR_UNSPECIFIED;
742  }
743 #else
744  rv = VNET_API_ERROR_UNIMPLEMENTED;
745 #endif
746 
747  REPLY_MACRO (VL_API_IKEV2_SET_RESPONDER_REPLY);
748 }
749 
750 static void
752  mp)
753 {
754  vl_api_ikev2_set_ike_transforms_reply_t *rmp;
755  int rv = 0;
756 
757 #if WITH_LIBSSL > 0
760 
761  u8 *tmp = format (0, "%s", mp->name);
762 
763  error =
764  ikev2_set_profile_ike_transforms (vm, tmp, mp->tr.crypto_alg,
765  mp->tr.integ_alg,
766  mp->tr.dh_group,
767  ntohl (mp->tr.crypto_key_size));
768  vec_free (tmp);
769  if (error)
770  {
773  rv = VNET_API_ERROR_UNSPECIFIED;
774  }
775 #else
776  rv = VNET_API_ERROR_UNIMPLEMENTED;
777 #endif
778 
779  REPLY_MACRO (VL_API_IKEV2_SET_IKE_TRANSFORMS_REPLY);
780 }
781 
782 static void
784  mp)
785 {
786  vl_api_ikev2_set_esp_transforms_reply_t *rmp;
787  int rv = 0;
788 
789 #if WITH_LIBSSL > 0
792 
793  u8 *tmp = format (0, "%s", mp->name);
794 
795  error =
796  ikev2_set_profile_esp_transforms (vm, tmp, mp->tr.crypto_alg,
797  mp->tr.integ_alg,
798  ntohl (mp->tr.crypto_key_size));
799  vec_free (tmp);
800  if (error)
801  {
804  rv = VNET_API_ERROR_UNSPECIFIED;
805  }
806 #else
807  rv = VNET_API_ERROR_UNIMPLEMENTED;
808 #endif
809 
810  REPLY_MACRO (VL_API_IKEV2_SET_ESP_TRANSFORMS_REPLY);
811 }
812 
813 static void
815 {
816  vl_api_ikev2_set_sa_lifetime_reply_t *rmp;
817  int rv = 0;
818 
819 #if WITH_LIBSSL > 0
822 
823  u8 *tmp = format (0, "%s", mp->name);
824 
825  error =
827  clib_net_to_host_u64 (mp->lifetime),
828  ntohl (mp->lifetime_jitter),
829  ntohl (mp->handover),
830  clib_net_to_host_u64
831  (mp->lifetime_maxdata));
832  vec_free (tmp);
833  if (error)
834  {
837  rv = VNET_API_ERROR_UNSPECIFIED;
838  }
839 #else
840  rv = VNET_API_ERROR_UNIMPLEMENTED;
841 #endif
842 
843  REPLY_MACRO (VL_API_IKEV2_SET_SA_LIFETIME_REPLY);
844 }
845 
846 static void
849 {
850  vl_api_ikev2_profile_set_ipsec_udp_port_reply_t *rmp;
851  int rv = 0;
852 
853 #if WITH_LIBSSL > 0
855 
856  u8 *tmp = format (0, "%s", mp->name);
857 
858  rv =
860  clib_net_to_host_u16 (mp->port),
861  mp->is_set);
862  vec_free (tmp);
863 #else
864  rv = VNET_API_ERROR_UNIMPLEMENTED;
865 #endif
866 
867  REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_IPSEC_UDP_PORT_REPLY);
868 }
869 
870 static void
873 {
874  vl_api_ikev2_set_tunnel_interface_reply_t *rmp;
875  int rv = 0;
876 
878 
879 #if WITH_LIBSSL > 0
880  u8 *tmp = format (0, "%s", mp->name);
882 
884  ntohl (mp->sw_if_index));
885 
886  if (error)
887  {
890  rv = VNET_API_ERROR_UNSPECIFIED;
891  }
892  vec_free (tmp);
893 #else
894  rv = VNET_API_ERROR_UNIMPLEMENTED;
895 #endif
896 
898  REPLY_MACRO (VL_API_IKEV2_SET_TUNNEL_INTERFACE_REPLY);
899 }
900 
901 static void
903 {
904  vl_api_ikev2_initiate_sa_init_reply_t *rmp;
905  int rv = 0;
906 
907 #if WITH_LIBSSL > 0
910 
911  u8 *tmp = format (0, "%s", mp->name);
912 
914  vec_free (tmp);
915  if (error)
916  {
919  rv = VNET_API_ERROR_UNSPECIFIED;
920  }
921 #else
922  rv = VNET_API_ERROR_UNIMPLEMENTED;
923 #endif
924 
925  REPLY_MACRO (VL_API_IKEV2_INITIATE_SA_INIT_REPLY);
926 }
927 
928 static void
930  * mp)
931 {
932  vl_api_ikev2_initiate_del_ike_sa_reply_t *rmp;
933  int rv = 0;
934 
935 #if WITH_LIBSSL > 0
938 
940  if (error)
941  {
944  rv = VNET_API_ERROR_UNSPECIFIED;
945  }
946 #else
947  rv = VNET_API_ERROR_UNIMPLEMENTED;
948 #endif
949 
950  REPLY_MACRO (VL_API_IKEV2_INITIATE_DEL_IKE_SA_REPLY);
951 }
952 
953 static void
956 {
957  vl_api_ikev2_initiate_del_child_sa_reply_t *rmp;
958  int rv = 0;
959 
960 #if WITH_LIBSSL > 0
963 
965  if (error)
966  {
969  rv = VNET_API_ERROR_UNSPECIFIED;
970  }
971 #else
972  rv = VNET_API_ERROR_UNIMPLEMENTED;
973 #endif
974 
975  REPLY_MACRO (VL_API_IKEV2_INITIATE_DEL_CHILD_SA_REPLY);
976 }
977 
978 static void
981 {
982  vl_api_ikev2_profile_disable_natt_reply_t *rmp;
983  int rv = 0;
984 
985 #if WITH_LIBSSL > 0
987 
988  u8 *tmp = format (0, "%s", mp->name);
990  vec_free (tmp);
991  if (error)
992  {
995  rv = VNET_API_ERROR_UNSPECIFIED;
996  }
997 #else
998  rv = VNET_API_ERROR_UNIMPLEMENTED;
999 #endif
1000 
1001  REPLY_MACRO (VL_API_IKEV2_PROFILE_DISABLE_NATT_REPLY);
1002 }
1003 
1004 static void
1007 {
1008  vl_api_ikev2_initiate_rekey_child_sa_reply_t *rmp;
1009  int rv = 0;
1010 
1011 #if WITH_LIBSSL > 0
1014 
1016  if (error)
1017  {
1020  rv = VNET_API_ERROR_UNSPECIFIED;
1021  }
1022 #else
1023  rv = VNET_API_ERROR_UNIMPLEMENTED;
1024 #endif
1025 
1026  REPLY_MACRO (VL_API_IKEV2_INITIATE_REKEY_CHILD_SA_REPLY);
1027 }
1028 
1029 #include <ikev2/ikev2.api.c>
1030 static clib_error_t *
1032 {
1034 
1035  /* Ask for a correctly-sized block of API message decode slots */
1036  im->msg_id_base = setup_message_id_table ();
1037 
1038  return 0;
1039 }
1040 
1042 
1043 /*
1044  * fd.io coding-style-patch-verification: ON
1045  *
1046  * Local Variables:
1047  * eval: (c-set-style "gnu")
1048  * End:
1049  */
ikev2_profile_t::tun_itf
u32 tun_itf
Definition: ikev2_priv.h:350
vl_api_ikev2_initiate_rekey_child_sa_t
IKEv2: Initiate the rekey Child SA exchange.
Definition: ikev2.api:452
ip_address
Definition: ip_types.h:79
tmp
u32 * tmp
Definition: interface_output.c:1078
ikev2_main_t
Definition: ikev2_priv.h:486
im
vnet_interface_main_t * im
Definition: interface_output.c:395
vl_api_ikev2_set_tunnel_interface_t::name
string name[64]
Definition: ikev2.api:311
ikev2_child_sa_t::i_proposals
ikev2_sa_proposal_t * i_proposals
Definition: ikev2_priv.h:282
ikev2_log_error
#define ikev2_log_error(...)
Definition: ikev2_priv.h:180
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
vl_api_ikev2_set_sa_lifetime_t_handler
static void vl_api_ikev2_set_sa_lifetime_t_handler(vl_api_ikev2_set_sa_lifetime_t *mp)
Definition: ikev2_api.c:814
auth
vl_api_ikev2_auth_t auth
Definition: ikev2_types.api:88
ikev2_set_profile_sa_lifetime
clib_error_t * ikev2_set_profile_sa_lifetime(vlib_main_t *vm, u8 *name, u64 lifetime, u32 jitter, u32 handover, u64 maxdata)
Definition: ikev2.c:4210
ikev2_sa_transform_t::encr_type
ikev2_transform_encr_type_t encr_type
Definition: ikev2_priv.h:219
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
api.h
vl_api_ikev2_set_local_key_t
IKEv2: Set IKEv2 local RSA private key.
Definition: ikev2.api:290
vl_api_ikev2_profile_add_del_t_handler
static void vl_api_ikev2_profile_add_del_t_handler(vl_api_ikev2_profile_add_del_t *mp)
Definition: ikev2_api.c:512
vl_api_ikev2_set_ike_transforms_t::tr
vl_api_ikev2_ike_transforms_t tr
Definition: ikev2.api:357
ikev2_sa_t::ispi
u64 ispi
Definition: ikev2_priv.h:387
ikev2_child_sa_t::sk_er
u8 * sk_er
Definition: ikev2_priv.h:293
ikev2_set_profile_tunnel_interface
clib_error_t * ikev2_set_profile_tunnel_interface(vlib_main_t *vm, u8 *name, u32 sw_if_index)
Definition: ikev2.c:4147
ikev2_initiate_rekey_child_sa
clib_error_t * ikev2_initiate_rekey_child_sa(vlib_main_t *vm, u32 ispi)
Definition: ikev2.c:4636
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
end_addr
vl_api_address_t end_addr
Definition: ikev2_types.api:38
ikev2_profile_t::name
u8 * name
Definition: ikev2_priv.h:334
ikev2_profile_t::handover
u32 handover
Definition: ikev2_priv.h:347
ikev2_profile_t::loc_id
ikev2_id_t loc_id
Definition: ikev2_priv.h:337
vl_api_ikev2_set_responder_hostname_t::hostname
string hostname[64]
Definition: ikev2.api:340
vl_api_ikev2_profile_set_liveness_t::max_retries
u32 max_retries
Definition: ikev2.api:506
vl_api_ikev2_nonce_get_t::is_initiator
bool is_initiator
Definition: ikev2.api:133
vl_api_ikev2_initiate_del_ike_sa_t_handler
static void vl_api_ikev2_initiate_del_ike_sa_t_handler(vl_api_ikev2_initiate_del_ike_sa_t *mp)
Definition: ikev2_api.c:929
vl_api_ikev2_profile_set_ipsec_udp_port_t::is_set
u8 is_set
Definition: ikev2.api:488
vec_new
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
Definition: vec.h:365
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
ikev2_profile_t::lifetime_jitter
u32 lifetime_jitter
Definition: ikev2_priv.h:346
ikev2_sa_proposal_t::spi
u32 spi
Definition: ikev2_priv.h:241
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
ikev2_ts_t::end_addr
ip_address_t end_addr
Definition: ikev2_priv.h:253
vl_api_ikev2_initiate_del_ike_sa_t::ispi
u64 ispi
Definition: ikev2.api:427
ikev2_sa_t::raddr
ip_address_t raddr
Definition: ikev2_priv.h:386
ikev2_transforms_set::crypto_key_size
u32 crypto_key_size
Definition: ikev2_priv.h:269
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
vl_api_ikev2_set_sa_lifetime_t::handover
u32 handover
Definition: ikev2.api:396
vl_api_ikev2_profile_set_ipsec_udp_port_t::port
u16 port
Definition: ikev2.api:489
vl_api_ikev2_set_ike_transforms_t
IKEv2: Set IKEv2 IKE transforms in SA_INIT proposal (RFC 7296)
Definition: ikev2.api:351
vl_api_ikev2_set_sa_lifetime_t
IKEv2: Set Child SA lifetime, limited by time and/or data.
Definition: ikev2.api:388
REPLY_MACRO2_ZERO
#define REPLY_MACRO2_ZERO(t, body)
Definition: api_helper_macros.h:101
vl_api_ikev2_profile_set_id_t_handler
static void vl_api_ikev2_profile_set_id_t_handler(vl_api_ikev2_profile_set_id_t *mp)
Definition: ikev2_api.c:573
ikev2_stats_t
Definition: ikev2_priv.h:370
vl_api_ikev2_traffic_selector_dump_t
dump traffic selectors
Definition: ikev2.api:164
vl_api_ikev2_sa_details_t
Details about IKE SA.
Definition: ikev2.api:84
vl_api_ikev2_profile_set_id_t
IKEv2: Set IKEv2 profile local/remote identification.
Definition: ikev2.api:240
vl_api_ikev2_child_sa_dump_t
Dump child SA of specific SA.
Definition: ikev2.api:98
ikev2_sa_transform_t
Definition: ikev2_priv.h:213
vl_api_ikev2_initiate_sa_init_t_handler
static void vl_api_ikev2_initiate_sa_init_t_handler(vl_api_ikev2_initiate_sa_init_t *mp)
Definition: ikev2_api.c:902
ikev2_encode_sa_index
static u32 ikev2_encode_sa_index(u32 sai, u32 ti)
Definition: ikev2_api.c:49
ikev2_transforms_set::integ_alg
ikev2_transform_integ_type_t integ_alg
Definition: ikev2_priv.h:267
ikev2_profile_t::ike_ts
ikev2_transforms_set ike_ts
Definition: ikev2_priv.h:342
vl_api_ikev2_profile_set_auth_t::data
u8 data[data_len]
Definition: ikev2.api:226
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
ikev2_transforms_set::crypto_alg
ikev2_transform_encr_type_t crypto_alg
Definition: ikev2_priv.h:266
vl_api_ikev2_initiate_del_ike_sa_t
IKEv2: Initiate the delete IKE SA exchange.
Definition: ikev2.api:422
ikev2_sa_t::i_id
ikev2_id_t i_id
Definition: ikev2_priv.h:417
vl_api_ikev2_nonce_get_t_handler
static void vl_api_ikev2_nonce_get_t_handler(vl_api_ikev2_nonce_get_t *mp)
Definition: ikev2_api.c:430
ikev2_sa_t::childs
ikev2_child_sa_t * childs
Definition: ikev2_priv.h:452
ikev2_set_profile_esp_transforms
clib_error_t * ikev2_set_profile_esp_transforms(vlib_main_t *vm, u8 *name, ikev2_transform_encr_type_t crypto_alg, ikev2_transform_integ_type_t integ_alg, u32 crypto_key_size)
Definition: ikev2.c:4124
cp_ike_transforms
static void cp_ike_transforms(vl_api_ikev2_ike_transforms_t *vl_api_ts, ikev2_transforms_set *ts)
Definition: ikev2_api.c:62
ikev2_api_init
static clib_error_t * ikev2_api_init(vlib_main_t *vm)
Definition: ikev2_api.c:1031
vl_api_ikev2_child_sa_dump_t_handler
static void vl_api_ikev2_child_sa_dump_t_handler(vl_api_ikev2_child_sa_dump_t *mp)
Definition: ikev2_api.c:355
start_addr
vl_api_address_t start_addr
Definition: ikev2_types.api:37
ikev2_set_local_key
clib_error_t * ikev2_set_local_key(vlib_main_t *vm, u8 *file)
Definition: ikev2.c:3711
ikev2_transforms_set::dh_type
ikev2_transform_dh_type_t dh_type
Definition: ikev2_priv.h:268
ikev2_set_profile_id
clib_error_t * ikev2_set_profile_id(vlib_main_t *vm, u8 *name, u8 id_type, u8 *data, int is_local)
Definition: ikev2.c:3961
cp_ts
static void cp_ts(vl_api_ikev2_ts_t *vl_api_ts, ikev2_ts_t *ts, u8 is_local)
Definition: ikev2_api.c:97
vl_api_ikev2_set_tunnel_interface_t_handler
static void vl_api_ikev2_set_tunnel_interface_t_handler(vl_api_ikev2_set_tunnel_interface_t *mp)
Definition: ikev2_api.c:872
vl_api_ikev2_profile_set_ts_t::ts
vl_api_ikev2_ts_t ts
Definition: ikev2.api:280
vl_api_ikev2_profile_set_auth_t::auth_method
u8 auth_method
Definition: ikev2.api:223
ikev2_sa_t
Definition: ikev2_priv.h:380
vl_api_ikev2_profile_set_auth_t::is_hex
bool is_hex
Definition: ikev2.api:224
error
Definition: cJSON.c:88
vl_api_ikev2_profile_add_del_t::name
string name[64]
Definition: ikev2.api:202
ikev2_priv.h
vl_api_ikev2_initiate_del_child_sa_t
IKEv2: Initiate the delete Child SA exchange.
Definition: ikev2.api:437
ikev2_child_sa_t::sk_ei
u8 * sk_ei
Definition: ikev2_priv.h:292
ikev2_set_profile_ipsec_udp_port
vnet_api_error_t ikev2_set_profile_ipsec_udp_port(vlib_main_t *vm, u8 *name, u16 port, u8 is_set)
Definition: ikev2.c:4167
ikev2_sa_t::rspi
u64 rspi
Definition: ikev2_priv.h:388
vl_api_ikev2_initiate_del_child_sa_t_handler
static void vl_api_ikev2_initiate_del_child_sa_t_handler(vl_api_ikev2_initiate_del_child_sa_t *mp)
Definition: ikev2_api.c:955
ikev2_child_sa_t::sk_ar
u8 * sk_ar
Definition: ikev2_priv.h:291
format_clib_error
__clib_export u8 * format_clib_error(u8 *s, va_list *va)
Definition: error.c:191
vl_api_ikev2_profile_set_ts_t::name
string name[64]
Definition: ikev2.api:279
ikev2_profile_t::loc_ts
ikev2_ts_t loc_ts
Definition: ikev2_priv.h:339
ikev2_main_t::per_thread_data
ikev2_main_per_thread_data_t * per_thread_data
Definition: ikev2_priv.h:509
vl_api_ikev2_traffic_selector_dump_t_handler
static void vl_api_ikev2_traffic_selector_dump_t_handler(vl_api_ikev2_traffic_selector_dump_t *mp)
Definition: ikev2_api.c:384
ip_address_encode2
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
Definition: ip_types_api.c:242
cp_id
static void cp_id(vl_api_ikev2_id_t *vl_api_id, ikev2_id_t *id)
Definition: ikev2_api.c:81
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
vl_api_ikev2_set_responder_t::responder
vl_api_ikev2_responder_t responder
Definition: ikev2.api:329
ikev2_profile_t::rem_ts
ikev2_ts_t rem_ts
Definition: ikev2_priv.h:340
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: bfd_api.c:451
vl_api_ikev2_set_responder_t::name
string name[64]
Definition: ikev2.api:328
vl_api_ikev2_initiate_rekey_child_sa_t::ispi
u32 ispi
Definition: ikev2.api:457
vl_api_ikev2_traffic_selector_dump_t::is_initiator
bool is_initiator
Definition: ikev2.api:169
ti
u32 ti
Definition: interface_output.c:405
cp_responder
static void cp_responder(vl_api_ikev2_responder_t *vl_api_responder, ikev2_responder_t *responder)
Definition: ikev2_api.c:117
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vl_api_ikev2_profile_set_id_t::name
string name[64]
Definition: ikev2.api:245
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vl_api_ikev2_child_sa_dump_t::sa_index
u32 sa_index
Definition: ikev2.api:103
cp_esp_transforms
static void cp_esp_transforms(vl_api_ikev2_esp_transforms_t *vl_api_ts, ikev2_transforms_set *ts)
Definition: ikev2_api.c:72
ikev2_sa_transform_t::block_size
u16 block_size
Definition: ikev2_priv.h:228
ikev2_sa_t::sk_pi
u8 * sk_pi
Definition: ikev2_priv.h:409
ikev2_profile_t
Definition: ikev2_priv.h:332
ikev2_initiate_delete_child_sa
clib_error_t * ikev2_initiate_delete_child_sa(vlib_main_t *vm, u32 ispi)
Definition: ikev2.c:4513
ikev2_decode_sa_index
static void ikev2_decode_sa_index(u32 api_sai, u32 *sai, u32 *ti)
Definition: ikev2_api.c:55
vl_api_ikev2_profile_set_ts_t_handler
static void vl_api_ikev2_profile_set_ts_t_handler(vl_api_ikev2_profile_set_ts_t *mp)
Definition: ikev2_api.c:633
ikev2_profile_t::ipsec_over_udp_port
u16 ipsec_over_udp_port
Definition: ikev2_priv.h:348
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition: vec_bootstrap.h:203
IKEV2_MAX_DATA_LEN
#define IKEV2_MAX_DATA_LEN
Definition: ikev2_api.c:46
ikev2_sa_t::sk_ar
u8 * sk_ar
Definition: ikev2_priv.h:406
ikev2_ts_t::protocol_id
u8 protocol_id
Definition: ikev2_priv.h:248
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
ikev2_ts_t::end_port
u16 end_port
Definition: ikev2_priv.h:251
vl_api_ikev2_set_local_key_t::key_file
string key_file[256]
Definition: ikev2.api:295
vl_api_ikev2_profile_details_t::profile
vl_api_ikev2_profile_t profile
Definition: ikev2.api:63
ikev2_transforms_set
Definition: ikev2_priv.h:264
vl_api_ikev2_child_sa_details_t::child_sa
vl_api_ikev2_child_sa_t child_sa
Definition: ikev2.api:118
vl_api_ikev2_plugin_get_version_t
Get the plugin version.
Definition: ikev2.api:27
ikev2_sa_t::r_id
ikev2_id_t r_id
Definition: ikev2_priv.h:418
send_child_sa
static void send_child_sa(ikev2_child_sa_t *child, vl_api_ikev2_child_sa_dump_t *mp, u32 child_sa_index, u32 sa_index)
Definition: ikev2_api.c:298
vl_api_ikev2_set_esp_transforms_t::tr
vl_api_ikev2_esp_transforms_t tr
Definition: ikev2.api:374
send_profile
static void send_profile(ikev2_profile_t *profile, vl_api_registration_t *reg, u32 context)
Definition: ikev2_api.c:137
vl_api_ikev2_set_local_key_t_handler
static void vl_api_ikev2_set_local_key_t_handler(vl_api_ikev2_set_local_key_t *mp)
Definition: ikev2_api.c:665
vl_api_ikev2_plugin_get_version_t::client_index
u32 client_index
Definition: ikev2.api:29
responder
vl_api_ikev2_responder_t responder
Definition: ikev2_types.api:77
vl_api_ikev2_profile_disable_natt_t
IKEv2: Disable NAT traversal.
Definition: ikev2.api:259
vl_api_ikev2_profile_set_id_t::is_local
bool is_local
Definition: ikev2.api:246
vl_api_ikev2_profile_details_t
Details about all profiles.
Definition: ikev2.api:60
ikev2_set_profile_responder
clib_error_t * ikev2_set_profile_responder(vlib_main_t *vm, u8 *name, u32 sw_if_index, ip_address_t addr)
Definition: ikev2.c:4077
ikev2_child_sa_t::tsi
ikev2_ts_t * tsi
Definition: ikev2_priv.h:286
vl_api_ikev2_profile_set_udp_encap_t_handler
static void vl_api_ikev2_profile_set_udp_encap_t_handler(vl_api_ikev2_profile_set_udp_encap_t *mp)
Definition: ikev2_api.c:608
ikev2.h
ikev2_child_sa_t::r_proposals
ikev2_sa_proposal_t * r_proposals
Definition: ikev2_priv.h:283
ikev2_main_per_thread_data_t
Definition: ikev2_priv.h:468
ikev2_profile_t::natt_disabled
u8 natt_disabled
Definition: ikev2_priv.h:352
vl_api_ikev2_set_sa_lifetime_t::lifetime_jitter
u32 lifetime_jitter
Definition: ikev2.api:395
vl_api_ikev2_set_responder_t_handler
static void vl_api_ikev2_set_responder_t_handler(vl_api_ikev2_set_responder_t *mp)
Definition: ikev2_api.c:721
vl_api_ikev2_profile_disable_natt_t_handler
static void vl_api_ikev2_profile_disable_natt_t_handler(vl_api_ikev2_profile_disable_natt_t *mp)
Definition: ikev2_api.c:980
src
vl_api_address_t src
Definition: gre.api:54
vl_api_ikev2_set_responder_hostname_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ikev2.api:341
vl_api_ikev2_profile_set_liveness_t_handler
static void vl_api_ikev2_profile_set_liveness_t_handler(vl_api_ikev2_profile_set_liveness_t *mp)
Definition: ikev2_api.c:489
ikev2_ts_t::start_port
u16 start_port
Definition: ikev2_priv.h:250
vl_api_ikev2_plugin_get_version_reply_t::minor
u32 minor
Definition: ikev2.api:42
vl_api_ikev2_traffic_selector_dump_t::sa_index
u32 sa_index
Definition: ikev2.api:170
vl_api_ikev2_plugin_get_version_t_handler
static void vl_api_ikev2_plugin_get_version_t_handler(vl_api_ikev2_plugin_get_version_t *mp)
Definition: ikev2_api.c:464
IKEV2_PLUGIN_VERSION_MINOR
#define IKEV2_PLUGIN_VERSION_MINOR
Definition: ikev2_api.c:42
vl_api_ikev2_set_sa_lifetime_t::lifetime_maxdata
u64 lifetime_maxdata
Definition: ikev2.api:397
ikev2_initiate_sa_init
clib_error_t * ikev2_initiate_sa_init(vlib_main_t *vm, u8 *name)
Definition: ikev2.c:4286
vl_api_ikev2_plugin_get_version_t::context
u32 context
Definition: ikev2.api:30
ikev2_set_profile_auth
clib_error_t * ikev2_set_profile_auth(vlib_main_t *vm, u8 *name, u8 auth_method, u8 *auth_data, u8 data_hex_format)
Definition: ikev2.c:3918
vl_api_ikev2_profile_dump_t
Dump all profiles.
Definition: ikev2.api:49
ip_address_decode2
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
Definition: ip_types_api.c:192
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
vl_api_ikev2_profile_set_liveness_t
IKEv2: Set liveness parameters.
Definition: ikev2.api:500
vl_api_ikev2_set_tunnel_interface_t
IKEv2: Set the tunnel interface which will be protected by IKE If this API is not called,...
Definition: ikev2.api:307
vl_api_ikev2_profile_disable_natt_t::name
string name[64]
Definition: ikev2.api:264
data
u8 data[128]
Definition: ipsec_types.api:92
vl_api_ikev2_profile_set_ipsec_udp_port_t_handler
static void vl_api_ikev2_profile_set_ipsec_udp_port_t_handler(vl_api_ikev2_profile_set_ipsec_udp_port_t *mp)
Definition: ikev2_api.c:848
ikev2_profile_t::lifetime_maxdata
u64 lifetime_maxdata
Definition: ikev2_priv.h:345
id
u8 id[64]
Definition: dhcp.api:160
ikev2_profile_t::auth
ikev2_auth_t auth
Definition: ikev2_priv.h:336
vl_api_ikev2_profile_add_del_t
IKEv2: Add/delete profile.
Definition: ikev2.api:197
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
vl_api_ikev2_profile_set_auth_t::name
string name[64]
Definition: ikev2.api:222
pool_len
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:139
vl_api_ikev2_nonce_get_t
get specific nonce
Definition: ikev2.api:128
ikev2_copy_stats
static void ikev2_copy_stats(vl_api_ikev2_sa_stats_t *dst, const ikev2_stats_t *src)
Definition: ikev2_api.c:200
vl_api_ikev2_nonce_get_reply_t::nonce
u8 nonce[data_len]
Definition: ikev2.api:152
vl_api_ikev2_traffic_selector_details_t
details on specific traffic selector
Definition: ikev2.api:182
ikev2_ts_t::start_addr
ip_address_t start_addr
Definition: ikev2_priv.h:252
ikev2_profile_natt_disable
clib_error_t * ikev2_profile_natt_disable(u8 *name)
Definition: ikev2.c:4938
ikev2_set_profile_ike_transforms
clib_error_t * ikev2_set_profile_ike_transforms(vlib_main_t *vm, u8 *name, ikev2_transform_encr_type_t crypto_alg, ikev2_transform_integ_type_t integ_alg, ikev2_transform_dh_type_t dh_type, u32 crypto_key_size)
Definition: ikev2.c:4099
ikev2_child_sa_t::tsr
ikev2_ts_t * tsr
Definition: ikev2_priv.h:287
vl_api_ikev2_profile_set_auth_t_handler
static void vl_api_ikev2_profile_set_auth_t_handler(vl_api_ikev2_profile_set_auth_t *mp)
Definition: ikev2_api.c:538
format_fns.h
ikev2_sa_t::i_nonce
u8 * i_nonce
Definition: ikev2_priv.h:389
vl_api_ikev2_nonce_get_reply_t::data_len
u32 data_len
Definition: ikev2.api:151
format
description fragment has unexpected format
Definition: map.api:433
ikev2_profile_t::responder
ikev2_responder_t responder
Definition: ikev2_priv.h:341
data_len
u8 data_len
Definition: ikev2_types.api:24
ikev2_sa_t::r_proposals
ikev2_sa_proposal_t * r_proposals
Definition: ikev2_priv.h:401
vl_api_ikev2_profile_set_udp_encap_t::name
string name[64]
Definition: ikev2.api:472
vl_api_ikev2_profile_set_auth_t
IKEv2: Set IKEv2 profile authentication method.
Definition: ikev2.api:217
ikev2_sa_transform_t::key_len
u16 key_len
Definition: ikev2_priv.h:226
cp_sa_transform
void cp_sa_transform(vl_api_ikev2_sa_transform_t *vl_tr, ikev2_sa_transform_t *tr)
Definition: ikev2_api.c:125
ikev2_sa_t::sk_ei
u8 * sk_ei
Definition: ikev2_priv.h:407
u32
unsigned int u32
Definition: types.h:88
vl_api_ikev2_profile_set_auth_t::data_len
u32 data_len
Definition: ikev2.api:225
ikev2_sa_t::r_nonce
u8 * r_nonce
Definition: ikev2_priv.h:390
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
vl_api_ikev2_set_esp_transforms_t
IKEv2: Set IKEv2 ESP transforms in SA_INIT proposal (RFC 7296)
Definition: ikev2.api:368
vl_api_ikev2_profile_set_liveness_t::period
u32 period
Definition: ikev2.api:505
vl_api_ikev2_child_sa_details_t
Child SA details.
Definition: ikev2.api:113
vl_api_ikev2_plugin_get_version_reply_t::context
u32 context
Definition: ikev2.api:40
vnet_interface_main_t::per_thread_data
vnet_interface_per_thread_data_t * per_thread_data
Definition: interface.h:1039
vl_api_ikev2_plugin_get_version_reply_t::major
u32 major
Definition: ikev2.api:41
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
ikev2_sa_transform_t::type
ikev2_transform_type_t type
Definition: ikev2_priv.h:215
vl_api_ikev2_profile_set_id_t::data
u8 data[data_len]
Definition: ikev2.api:249
ikev2_sa_t::stats
ikev2_stats_t stats
Definition: ikev2_priv.h:464
vl_api_ikev2_sa_dump_t
Dump all SAs.
Definition: ikev2.api:71
api_helper_macros.h
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
ikev2_set_profile_udp_encap
clib_error_t * ikev2_set_profile_udp_encap(vlib_main_t *vm, u8 *name)
Definition: ikev2.c:4194
vl_api_ikev2_profile_set_ipsec_udp_port_t::name
string name[64]
Definition: ikev2.api:490
vl_api_ikev2_set_responder_hostname_t_handler
static void vl_api_ikev2_set_responder_hostname_t_handler(vl_api_ikev2_set_responder_hostname_t *mp)
Definition: ikev2_api.c:689
ikev2_profile_t::rem_id
ikev2_id_t rem_id
Definition: ikev2_priv.h:338
vl_api_ikev2_profile_set_udp_encap_t
IKEv2: Set UDP encapsulation.
Definition: ikev2.api:467
vl_api_ikev2_profile_set_id_t::id_type
u8 id_type
Definition: ikev2.api:247
ikev2_sa_t::sk_ai
u8 * sk_ai
Definition: ikev2_priv.h:405
ikev2_profile_t::udp_encap
u8 udp_encap
Definition: ikev2_priv.h:351
child_sa_index
u32 child_sa_index
Definition: ikev2_types.api:31
ikev2_sa_t::sk_er
u8 * sk_er
Definition: ikev2_priv.h:408
ikev2_profile_t::esp_ts
ikev2_transforms_set esp_ts
Definition: ikev2_priv.h:343
vl_api_ikev2_set_responder_hostname_t
Definition: ikev2.api:334
vl_api_ikev2_nonce_get_reply_t
reply on specific nonce
Definition: ikev2.api:146
vl_api_ikev2_initiate_rekey_child_sa_t_handler
static void vl_api_ikev2_initiate_rekey_child_sa_t_handler(vl_api_ikev2_initiate_rekey_child_sa_t *mp)
Definition: ikev2_api.c:1006
vl_api_ikev2_traffic_selector_dump_t::child_sa_index
u32 child_sa_index
Definition: ikev2.api:171
vl_api_ikev2_initiate_sa_init_t::name
string name[64]
Definition: ikev2.api:412
vl_api_ikev2_sa_dump_t_handler
static void vl_api_ikev2_sa_dump_t_handler(vl_api_ikev2_sa_dump_t *mp)
Definition: ikev2_api.c:277
vl_api_ikev2_nonce_get_t::sa_index
u32 sa_index
Definition: ikev2.api:134
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_ikev2_profile_set_id_t::data_len
u32 data_len
Definition: ikev2.api:248
vl_api_ikev2_set_sa_lifetime_t::name
string name[64]
Definition: ikev2.api:393
ikev2_sa_t::sk_pr
u8 * sk_pr
Definition: ikev2_priv.h:410
vl_api_ikev2_set_responder_t
IKEv2: Set IKEv2 responder interface and IP address.
Definition: ikev2.api:323
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vl_api_ikev2_sa_details_t::sa
vl_api_ikev2_sa_t sa
Definition: ikev2.api:89
ikev2_main_per_thread_data_t::sas
ikev2_sa_t * sas
Definition: ikev2_priv.h:473
ip
vl_api_address_t ip
Definition: l2.api:558
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
ikev2_initiate_delete_ike_sa
clib_error_t * ikev2_initiate_delete_ike_sa(vlib_main_t *vm, u64 ispi)
Definition: ikev2.c:4553
ikev2_add_del_profile
clib_error_t * ikev2_add_del_profile(vlib_main_t *vm, u8 *name, int is_add)
Definition: ikev2.c:3882
ikev2_set_profile_ts
clib_error_t * ikev2_set_profile_ts(vlib_main_t *vm, u8 *name, u8 protocol_id, u16 start_port, u16 end_port, ip_address_t start_addr, ip_address_t end_addr, int is_local)
Definition: ikev2.c:4016
ikev2_child_sa_t::sk_ai
u8 * sk_ai
Definition: ikev2_priv.h:290
cp_auth
static void cp_auth(vl_api_ikev2_auth_t *vl_api_auth, ikev2_auth_t *auth)
Definition: ikev2_api.c:108
vl_api_ikev2_profile_details_t::context
u32 context
Definition: ikev2.api:62
ikev2_sa_transform_t::key_trunc
u16 key_trunc
Definition: ikev2_priv.h:227
ikev2_sa_t::sk_d
u8 * sk_d
Definition: ikev2_priv.h:404
vl_api_ikev2_set_responder_hostname_t::name
string name[64]
Definition: ikev2.api:339
vl_api_ikev2_profile_set_ipsec_udp_port_t
IKEv2: Set/unset custom ipsec-over-udp port.
Definition: ikev2.api:483
vl_api_ikev2_set_sa_lifetime_t::lifetime
u64 lifetime
Definition: ikev2.api:394
vl_api_ikev2_set_esp_transforms_t_handler
static void vl_api_ikev2_set_esp_transforms_t_handler(vl_api_ikev2_set_esp_transforms_t *mp)
Definition: ikev2_api.c:783
ikev2_id_t
Definition: ikev2_priv.h:273
send_sa
static void send_sa(ikev2_sa_t *sa, vl_api_ikev2_sa_dump_t *mp, u32 api_sa_index)
Definition: ikev2_api.c:211
ikev2_auth_t
Definition: ikev2_priv.h:199
ikev2_responder_t
Definition: ikev2_priv.h:256
ikev2_ts_t
Definition: ikev2_priv.h:245
context
u32 context
Definition: ip.api:780
clib_error_free
#define clib_error_free(e)
Definition: error.h:86
rv
int __clib_unused rv
Definition: application.c:491
vl_api_ikev2_traffic_selector_details_t::ts
vl_api_ikev2_ts_t ts
Definition: ikev2.api:187
vnet.h
api_errno.h
vl_api_ikev2_profile_set_ts_t
IKEv2: Set IKEv2 profile traffic selector parameters.
Definition: ikev2.api:274
vl_api_ikev2_profile_dump_t::client_index
u32 client_index
Definition: ikev2.api:51
ikev2_set_liveness_params
clib_error_t * ikev2_set_liveness_params(u32 period, u32 max_retries)
Definition: ikev2.c:4925
is_local
bool is_local
Definition: ikev2_types.api:33
ikev2_set_profile_responder_hostname
clib_error_t * ikev2_set_profile_responder_hostname(vlib_main_t *vm, u8 *name, u8 *hostname, u32 sw_if_index)
Definition: ikev2.c:4055
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
ip_types_api.h
ikev2_child_sa_t
Definition: ikev2_priv.h:279
ikev2_sa_get_td_for_type
ikev2_sa_transform_t * ikev2_sa_get_td_for_type(ikev2_sa_proposal_t *p, ikev2_transform_type_t type)
Definition: ikev2.c:228
ikev2_sa_transform_t::dh_group
u8 dh_group
Definition: ikev2_priv.h:229
ikev2_auth_t::data
u8 * data
Definition: ikev2_priv.h:202
vl_api_ikev2_profile_dump_t::context
u32 context
Definition: ikev2.api:52
vl_api_ikev2_set_tunnel_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: ikev2.api:313
vl_api_ikev2_set_ike_transforms_t_handler
static void vl_api_ikev2_set_ike_transforms_t_handler(vl_api_ikev2_set_ike_transforms_t *mp)
Definition: ikev2_api.c:751
ikev2_sa_t::iaddr
ip_address_t iaddr
Definition: ikev2_priv.h:385
vl_api_ikev2_profile_add_del_t::is_add
bool is_add
Definition: ikev2.api:203
vl_api_ikev2_plugin_get_version_reply_t
Reply to get the plugin version.
Definition: ikev2.api:38
vl_api_ikev2_set_esp_transforms_t::name
string name[64]
Definition: ikev2.api:373
vl_api_ikev2_set_ike_transforms_t::name
string name[64]
Definition: ikev2.api:356
REPLY_MACRO3_ZERO
#define REPLY_MACRO3_ZERO(t, n, body)
Definition: api_helper_macros.h:157
ikev2_main
ikev2_main_t ikev2_main
Definition: ikev2.c:37
vl_api_ikev2_profile_dump_t_handler
static void vl_api_ikev2_profile_dump_t_handler(vl_api_ikev2_profile_dump_t *mp)
Definition: ikev2_api.c:182
vl_api_ikev2_initiate_sa_init_t
IKEv2: Initiate the SA_INIT exchange.
Definition: ikev2.api:407
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
IKEV2_PLUGIN_VERSION_MAJOR
#define IKEV2_PLUGIN_VERSION_MAJOR
Definition: ikev2_api.c:41
ikev2_profile_t::lifetime
u64 lifetime
Definition: ikev2_priv.h:344
vl_api_ikev2_initiate_del_child_sa_t::ispi
u32 ispi
Definition: ikev2.api:442