2 *------------------------------------------------------------------
3 * ipsec_api.c - ipsec api
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:
10 * http://www.apache.org/licenses/LICENSE-2.0
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 *------------------------------------------------------------------
20 #include <vnet/vnet.h>
21 #include <vlibmemory/api.h>
23 #include <vnet/interface.h>
24 #include <vnet/api_errno.h>
25 #include <vnet/ip/ip.h>
27 #include <vnet/vnet_msg_enum.h>
30 #include <vnet/ipsec/ipsec.h>
31 #include <vnet/ipsec/ikev2.h>
34 #define vl_typedefs /* define message structures */
35 #include <vnet/vnet_all_api_h.h>
38 #define vl_endianfun /* define message structures */
39 #include <vnet/vnet_all_api_h.h>
42 /* instantiate all the print functions we know about */
43 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
45 #include <vnet/vnet_all_api_h.h>
48 #include <vlibapi/api_helper_macros.h>
50 #define foreach_vpe_api_msg \
51 _(IPSEC_SPD_ADD_DEL, ipsec_spd_add_del) \
52 _(IPSEC_INTERFACE_ADD_DEL_SPD, ipsec_interface_add_del_spd) \
53 _(IPSEC_SPD_ADD_DEL_ENTRY, ipsec_spd_add_del_entry) \
54 _(IPSEC_SAD_ADD_DEL_ENTRY, ipsec_sad_add_del_entry) \
55 _(IPSEC_SA_SET_KEY, ipsec_sa_set_key) \
56 _(IPSEC_SPD_DUMP, ipsec_spd_dump) \
57 _(IPSEC_TUNNEL_IF_ADD_DEL, ipsec_tunnel_if_add_del) \
58 _(IKEV2_PROFILE_ADD_DEL, ikev2_profile_add_del) \
59 _(IKEV2_PROFILE_SET_AUTH, ikev2_profile_set_auth) \
60 _(IKEV2_PROFILE_SET_ID, ikev2_profile_set_id) \
61 _(IKEV2_PROFILE_SET_TS, ikev2_profile_set_ts) \
62 _(IKEV2_SET_LOCAL_KEY, ikev2_set_local_key) \
63 _(IKEV2_SET_RESPONDER, ikev2_set_responder) \
64 _(IKEV2_SET_IKE_TRANSFORMS, ikev2_set_ike_transforms) \
65 _(IKEV2_SET_ESP_TRANSFORMS, ikev2_set_esp_transforms) \
66 _(IKEV2_SET_SA_LIFETIME, ikev2_set_sa_lifetime) \
67 _(IKEV2_INITIATE_SA_INIT, ikev2_initiate_sa_init) \
68 _(IKEV2_INITIATE_DEL_IKE_SA, ikev2_initiate_del_ike_sa) \
69 _(IKEV2_INITIATE_DEL_CHILD_SA, ikev2_initiate_del_child_sa) \
70 _(IKEV2_INITIATE_REKEY_CHILD_SA, ikev2_initiate_rekey_child_sa)
72 static void vl_api_ipsec_spd_add_del_t_handler
73 (vl_api_ipsec_spd_add_del_t * mp)
76 clib_warning ("unimplemented");
79 vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
80 vl_api_ipsec_spd_add_del_reply_t *rmp;
83 rv = ipsec_add_del_spd (vm, ntohl (mp->spd_id), mp->is_add);
85 REPLY_MACRO (VL_API_IPSEC_SPD_ADD_DEL_REPLY);
89 static void vl_api_ipsec_interface_add_del_spd_t_handler
90 (vl_api_ipsec_interface_add_del_spd_t * mp)
92 vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
93 vl_api_ipsec_interface_add_del_spd_reply_t *rmp;
95 u32 sw_if_index __attribute__ ((unused));
96 u32 spd_id __attribute__ ((unused));
98 sw_if_index = ntohl (mp->sw_if_index);
99 spd_id = ntohl (mp->spd_id);
101 VALIDATE_SW_IF_INDEX (mp);
104 rv = ipsec_set_interface_spd (vm, sw_if_index, spd_id, mp->is_add);
106 rv = VNET_API_ERROR_UNIMPLEMENTED;
109 BAD_SW_IF_INDEX_LABEL;
111 REPLY_MACRO (VL_API_IPSEC_INTERFACE_ADD_DEL_SPD_REPLY);
114 static void vl_api_ipsec_spd_add_del_entry_t_handler
115 (vl_api_ipsec_spd_add_del_entry_t * mp)
117 vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
118 vl_api_ipsec_spd_add_del_entry_reply_t *rmp;
124 memset (&p, 0, sizeof (p));
126 p.id = ntohl (mp->spd_id);
127 p.priority = ntohl (mp->priority);
128 p.is_outbound = mp->is_outbound;
129 p.is_ipv6 = mp->is_ipv6;
131 if (mp->is_ipv6 || mp->is_ip_any)
133 clib_memcpy (&p.raddr.start, mp->remote_address_start, 16);
134 clib_memcpy (&p.raddr.stop, mp->remote_address_stop, 16);
135 clib_memcpy (&p.laddr.start, mp->local_address_start, 16);
136 clib_memcpy (&p.laddr.stop, mp->local_address_stop, 16);
140 clib_memcpy (&p.raddr.start.ip4.data, mp->remote_address_start, 4);
141 clib_memcpy (&p.raddr.stop.ip4.data, mp->remote_address_stop, 4);
142 clib_memcpy (&p.laddr.start.ip4.data, mp->local_address_start, 4);
143 clib_memcpy (&p.laddr.stop.ip4.data, mp->local_address_stop, 4);
145 p.protocol = mp->protocol;
146 p.rport.start = ntohs (mp->remote_port_start);
147 p.rport.stop = ntohs (mp->remote_port_stop);
148 p.lport.start = ntohs (mp->local_port_start);
149 p.lport.stop = ntohs (mp->local_port_stop);
150 /* policy action resolve unsupported */
151 if (mp->policy == IPSEC_POLICY_ACTION_RESOLVE)
153 clib_warning ("unsupported action: 'resolve'");
154 rv = VNET_API_ERROR_UNIMPLEMENTED;
157 p.policy = mp->policy;
158 p.sa_id = ntohl (mp->sa_id);
160 rv = ipsec_add_del_policy (vm, &p, mp->is_add);
167 rv = ipsec_add_del_policy (vm, &p, mp->is_add);
170 rv = VNET_API_ERROR_UNIMPLEMENTED;
175 REPLY_MACRO (VL_API_IPSEC_SPD_ADD_DEL_ENTRY_REPLY);
178 static void vl_api_ipsec_sad_add_del_entry_t_handler
179 (vl_api_ipsec_sad_add_del_entry_t * mp)
181 vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
182 vl_api_ipsec_sad_add_del_entry_reply_t *rmp;
185 ipsec_main_t *im = &ipsec_main;
188 memset (&sa, 0, sizeof (sa));
190 sa.id = ntohl (mp->sad_id);
191 sa.spi = ntohl (mp->spi);
192 /* security protocol AH unsupported */
193 if (mp->protocol == IPSEC_PROTOCOL_AH)
195 clib_warning ("unsupported security protocol 'AH'");
196 rv = VNET_API_ERROR_UNIMPLEMENTED;
199 sa.protocol = mp->protocol;
200 /* check for unsupported crypto-alg */
201 if (mp->crypto_algorithm < IPSEC_CRYPTO_ALG_AES_CBC_128 ||
202 mp->crypto_algorithm >= IPSEC_CRYPTO_N_ALG)
204 clib_warning ("unsupported crypto-alg: '%U'", format_ipsec_crypto_alg,
205 mp->crypto_algorithm);
206 rv = VNET_API_ERROR_UNIMPLEMENTED;
209 sa.crypto_alg = mp->crypto_algorithm;
210 sa.crypto_key_len = mp->crypto_key_length;
211 clib_memcpy (&sa.crypto_key, mp->crypto_key, sizeof (sa.crypto_key));
212 /* check for unsupported integ-alg */
213 if (mp->integrity_algorithm >= IPSEC_INTEG_N_ALG)
215 clib_warning ("unsupported integ-alg: '%U'", format_ipsec_integ_alg,
216 mp->integrity_algorithm);
217 rv = VNET_API_ERROR_UNIMPLEMENTED;
221 sa.integ_alg = mp->integrity_algorithm;
222 sa.integ_key_len = mp->integrity_key_length;
223 clib_memcpy (&sa.integ_key, mp->integrity_key, sizeof (sa.integ_key));
224 sa.use_esn = mp->use_extended_sequence_number;
225 sa.is_tunnel = mp->is_tunnel;
226 sa.is_tunnel_ip6 = mp->is_tunnel_ipv6;
227 if (sa.is_tunnel_ip6)
229 clib_memcpy (&sa.tunnel_src_addr, mp->tunnel_src_address, 16);
230 clib_memcpy (&sa.tunnel_dst_addr, mp->tunnel_dst_address, 16);
234 clib_memcpy (&sa.tunnel_src_addr.ip4.data, mp->tunnel_src_address, 4);
235 clib_memcpy (&sa.tunnel_dst_addr.ip4.data, mp->tunnel_dst_address, 4);
238 ASSERT (im->cb.check_support_cb);
239 clib_error_t *err = im->cb.check_support_cb (&sa);
242 clib_warning ("%s", err->what);
243 rv = VNET_API_ERROR_UNIMPLEMENTED;
247 rv = ipsec_add_del_sa (vm, &sa, mp->is_add);
249 rv = VNET_API_ERROR_UNIMPLEMENTED;
254 REPLY_MACRO (VL_API_IPSEC_SAD_ADD_DEL_ENTRY_REPLY);
258 send_ipsec_spd_details (ipsec_policy_t * p, unix_shared_memory_queue_t * q,
261 vl_api_ipsec_spd_details_t *mp;
263 mp = vl_msg_api_alloc (sizeof (*mp));
264 memset (mp, 0, sizeof (*mp));
265 mp->_vl_msg_id = ntohs (VL_API_IPSEC_SPD_DETAILS);
266 mp->context = context;
268 mp->spd_id = htonl (p->id);
269 mp->priority = htonl (p->priority);
270 mp->is_outbound = p->is_outbound;
271 mp->is_ipv6 = p->is_ipv6;
274 memcpy (mp->local_start_addr, &p->laddr.start.ip6, 16);
275 memcpy (mp->local_stop_addr, &p->laddr.stop.ip6, 16);
276 memcpy (mp->remote_start_addr, &p->raddr.start.ip6, 16);
277 memcpy (mp->remote_stop_addr, &p->raddr.stop.ip6, 16);
281 memcpy (mp->local_start_addr, &p->laddr.start.ip4, 4);
282 memcpy (mp->local_stop_addr, &p->laddr.stop.ip4, 4);
283 memcpy (mp->remote_start_addr, &p->raddr.start.ip4, 4);
284 memcpy (mp->remote_stop_addr, &p->raddr.stop.ip4, 4);
286 mp->local_start_port = htons (p->lport.start);
287 mp->local_stop_port = htons (p->lport.stop);
288 mp->remote_start_port = htons (p->rport.start);
289 mp->remote_stop_port = htons (p->rport.stop);
290 mp->protocol = p->protocol;
291 mp->policy = p->policy;
292 mp->sa_id = htonl (p->sa_id);
293 mp->bytes = clib_host_to_net_u64 (p->counter.bytes);
294 mp->packets = clib_host_to_net_u64 (p->counter.packets);
296 vl_msg_api_send_shmem (q, (u8 *) & mp);
300 vl_api_ipsec_spd_dump_t_handler (vl_api_ipsec_spd_dump_t * mp)
302 unix_shared_memory_queue_t *q;
303 ipsec_main_t *im = &ipsec_main;
304 ipsec_policy_t *policy;
309 q = vl_api_client_index_to_input_queue (mp->client_index);
313 p = hash_get (im->spd_index_by_spd_id, ntohl (mp->spd_id));
318 spd = pool_elt_at_index (im->spds, spd_index);
321 pool_foreach (policy, spd->policies,
323 if (mp->sa_id == ~(0) || ntohl (mp->sa_id) == policy->sa_id)
324 send_ipsec_spd_details (policy, q,
329 clib_warning ("unimplemented");
334 vl_api_ipsec_sa_set_key_t_handler (vl_api_ipsec_sa_set_key_t * mp)
336 vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
337 vl_api_ipsec_sa_set_key_reply_t *rmp;
341 sa.id = ntohl (mp->sa_id);
342 sa.crypto_key_len = mp->crypto_key_length;
343 clib_memcpy (&sa.crypto_key, mp->crypto_key, sizeof (sa.crypto_key));
344 sa.integ_key_len = mp->integrity_key_length;
345 clib_memcpy (&sa.integ_key, mp->integrity_key, sizeof (sa.integ_key));
347 rv = ipsec_set_sa_key (vm, &sa);
349 rv = VNET_API_ERROR_UNIMPLEMENTED;
352 REPLY_MACRO (VL_API_IPSEC_SA_SET_KEY_REPLY);
356 vl_api_ipsec_tunnel_if_add_del_t_handler (vl_api_ipsec_tunnel_if_add_del_t *
359 vl_api_ipsec_tunnel_if_add_del_reply_t *rmp;
360 ipsec_main_t *im = &ipsec_main;
361 vnet_main_t *vnm = im->vnet_main;
362 u32 sw_if_index = ~0;
366 ipsec_add_del_tunnel_args_t tun;
368 memset (&tun, 0, sizeof (ipsec_add_del_tunnel_args_t));
370 tun.is_add = mp->is_add;
372 tun.anti_replay = mp->anti_replay;
373 tun.local_spi = ntohl (mp->local_spi);
374 tun.remote_spi = ntohl (mp->remote_spi);
375 tun.crypto_alg = mp->crypto_alg;
376 tun.local_crypto_key_len = mp->local_crypto_key_len;
377 tun.remote_crypto_key_len = mp->remote_crypto_key_len;
378 tun.integ_alg = mp->integ_alg;
379 tun.local_integ_key_len = mp->local_integ_key_len;
380 tun.remote_integ_key_len = mp->remote_integ_key_len;
381 memcpy (&tun.local_ip, mp->local_ip, 4);
382 memcpy (&tun.remote_ip, mp->remote_ip, 4);
383 memcpy (&tun.local_crypto_key, &mp->local_crypto_key,
384 mp->local_crypto_key_len);
385 memcpy (&tun.remote_crypto_key, &mp->remote_crypto_key,
386 mp->remote_crypto_key_len);
387 memcpy (&tun.local_integ_key, &mp->local_integ_key,
388 mp->local_integ_key_len);
389 memcpy (&tun.remote_integ_key, &mp->remote_integ_key,
390 mp->remote_integ_key_len);
392 rv = ipsec_add_del_tunnel_if_internal (vnm, &tun, &sw_if_index);
395 rv = VNET_API_ERROR_UNIMPLEMENTED;
398 REPLY_MACRO2 (VL_API_IPSEC_TUNNEL_IF_ADD_DEL_REPLY, (
407 vl_api_ikev2_profile_add_del_t_handler (vl_api_ikev2_profile_add_del_t * mp)
409 vl_api_ikev2_profile_add_del_reply_t *rmp;
413 vlib_main_t *vm = vlib_get_main ();
415 u8 *tmp = format (0, "%s", mp->name);
416 error = ikev2_add_del_profile (vm, tmp, mp->is_add);
419 rv = VNET_API_ERROR_UNSPECIFIED;
421 rv = VNET_API_ERROR_UNIMPLEMENTED;
424 REPLY_MACRO (VL_API_IKEV2_PROFILE_ADD_DEL_REPLY);
428 vl_api_ikev2_profile_set_auth_t_handler
429 (vl_api_ikev2_profile_set_auth_t * mp)
431 vl_api_ikev2_profile_set_auth_reply_t *rmp;
435 vlib_main_t *vm = vlib_get_main ();
437 u8 *tmp = format (0, "%s", mp->name);
438 u8 *data = vec_new (u8, mp->data_len);
439 clib_memcpy (data, mp->data, mp->data_len);
440 error = ikev2_set_profile_auth (vm, tmp, mp->auth_method, data, mp->is_hex);
444 rv = VNET_API_ERROR_UNSPECIFIED;
446 rv = VNET_API_ERROR_UNIMPLEMENTED;
449 REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_AUTH_REPLY);
453 vl_api_ikev2_profile_set_id_t_handler (vl_api_ikev2_profile_set_id_t * mp)
455 vl_api_ikev2_profile_add_del_reply_t *rmp;
459 vlib_main_t *vm = vlib_get_main ();
461 u8 *tmp = format (0, "%s", mp->name);
462 u8 *data = vec_new (u8, mp->data_len);
463 clib_memcpy (data, mp->data, mp->data_len);
464 error = ikev2_set_profile_id (vm, tmp, mp->id_type, data, mp->is_local);
468 rv = VNET_API_ERROR_UNSPECIFIED;
470 rv = VNET_API_ERROR_UNIMPLEMENTED;
473 REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_ID_REPLY);
477 vl_api_ikev2_profile_set_ts_t_handler (vl_api_ikev2_profile_set_ts_t * mp)
479 vl_api_ikev2_profile_set_ts_reply_t *rmp;
483 vlib_main_t *vm = vlib_get_main ();
485 u8 *tmp = format (0, "%s", mp->name);
486 error = ikev2_set_profile_ts (vm, tmp, mp->proto, mp->start_port,
487 mp->end_port, (ip4_address_t) mp->start_addr,
488 (ip4_address_t) mp->end_addr, mp->is_local);
491 rv = VNET_API_ERROR_UNSPECIFIED;
493 rv = VNET_API_ERROR_UNIMPLEMENTED;
496 REPLY_MACRO (VL_API_IKEV2_PROFILE_SET_TS_REPLY);
500 vl_api_ikev2_set_local_key_t_handler (vl_api_ikev2_set_local_key_t * mp)
502 vl_api_ikev2_profile_set_ts_reply_t *rmp;
506 vlib_main_t *vm = vlib_get_main ();
509 error = ikev2_set_local_key (vm, mp->key_file);
511 rv = VNET_API_ERROR_UNSPECIFIED;
513 rv = VNET_API_ERROR_UNIMPLEMENTED;
516 REPLY_MACRO (VL_API_IKEV2_SET_LOCAL_KEY_REPLY);
520 vl_api_ikev2_set_responder_t_handler (vl_api_ikev2_set_responder_t * mp)
522 vl_api_ikev2_set_responder_reply_t *rmp;
526 vlib_main_t *vm = vlib_get_main ();
529 u8 *tmp = format (0, "%s", mp->name);
531 clib_memcpy (&ip4, mp->address, sizeof (ip4));
533 error = ikev2_set_profile_responder (vm, tmp, mp->sw_if_index, ip4);
536 rv = VNET_API_ERROR_UNSPECIFIED;
538 rv = VNET_API_ERROR_UNIMPLEMENTED;
541 REPLY_MACRO (VL_API_IKEV2_SET_RESPONDER_REPLY);
545 vl_api_ikev2_set_ike_transforms_t_handler (vl_api_ikev2_set_ike_transforms_t *
548 vl_api_ikev2_set_ike_transforms_reply_t *rmp;
552 vlib_main_t *vm = vlib_get_main ();
555 u8 *tmp = format (0, "%s", mp->name);
558 ikev2_set_profile_ike_transforms (vm, tmp, mp->crypto_alg, mp->integ_alg,
559 mp->dh_group, mp->crypto_key_size);
562 rv = VNET_API_ERROR_UNSPECIFIED;
564 rv = VNET_API_ERROR_UNIMPLEMENTED;
567 REPLY_MACRO (VL_API_IKEV2_SET_IKE_TRANSFORMS_REPLY);
571 vl_api_ikev2_set_esp_transforms_t_handler (vl_api_ikev2_set_esp_transforms_t *
574 vl_api_ikev2_set_esp_transforms_reply_t *rmp;
578 vlib_main_t *vm = vlib_get_main ();
581 u8 *tmp = format (0, "%s", mp->name);
584 ikev2_set_profile_esp_transforms (vm, tmp, mp->crypto_alg, mp->integ_alg,
585 mp->dh_group, mp->crypto_key_size);
588 rv = VNET_API_ERROR_UNSPECIFIED;
590 rv = VNET_API_ERROR_UNIMPLEMENTED;
593 REPLY_MACRO (VL_API_IKEV2_SET_ESP_TRANSFORMS_REPLY);
597 vl_api_ikev2_set_sa_lifetime_t_handler (vl_api_ikev2_set_sa_lifetime_t * mp)
599 vl_api_ikev2_set_sa_lifetime_reply_t *rmp;
603 vlib_main_t *vm = vlib_get_main ();
606 u8 *tmp = format (0, "%s", mp->name);
609 ikev2_set_profile_sa_lifetime (vm, tmp, mp->lifetime, mp->lifetime_jitter,
610 mp->handover, mp->lifetime_maxdata);
613 rv = VNET_API_ERROR_UNSPECIFIED;
615 rv = VNET_API_ERROR_UNIMPLEMENTED;
618 REPLY_MACRO (VL_API_IKEV2_SET_SA_LIFETIME_REPLY);
622 vl_api_ikev2_initiate_sa_init_t_handler (vl_api_ikev2_initiate_sa_init_t * mp)
624 vl_api_ikev2_initiate_sa_init_reply_t *rmp;
628 vlib_main_t *vm = vlib_get_main ();
631 u8 *tmp = format (0, "%s", mp->name);
633 error = ikev2_initiate_sa_init (vm, tmp);
636 rv = VNET_API_ERROR_UNSPECIFIED;
638 rv = VNET_API_ERROR_UNIMPLEMENTED;
641 REPLY_MACRO (VL_API_IKEV2_INITIATE_SA_INIT_REPLY);
645 vl_api_ikev2_initiate_del_ike_sa_t_handler (vl_api_ikev2_initiate_del_ike_sa_t
648 vl_api_ikev2_initiate_del_ike_sa_reply_t *rmp;
652 vlib_main_t *vm = vlib_get_main ();
655 error = ikev2_initiate_delete_ike_sa (vm, mp->ispi);
657 rv = VNET_API_ERROR_UNSPECIFIED;
659 rv = VNET_API_ERROR_UNIMPLEMENTED;
662 REPLY_MACRO (VL_API_IKEV2_INITIATE_DEL_IKE_SA_REPLY);
666 vl_api_ikev2_initiate_del_child_sa_t_handler
667 (vl_api_ikev2_initiate_del_child_sa_t * mp)
669 vl_api_ikev2_initiate_del_child_sa_reply_t *rmp;
673 vlib_main_t *vm = vlib_get_main ();
676 error = ikev2_initiate_delete_child_sa (vm, mp->ispi);
678 rv = VNET_API_ERROR_UNSPECIFIED;
680 rv = VNET_API_ERROR_UNIMPLEMENTED;
683 REPLY_MACRO (VL_API_IKEV2_INITIATE_DEL_CHILD_SA_REPLY);
687 vl_api_ikev2_initiate_rekey_child_sa_t_handler
688 (vl_api_ikev2_initiate_rekey_child_sa_t * mp)
690 vl_api_ikev2_initiate_rekey_child_sa_reply_t *rmp;
694 vlib_main_t *vm = vlib_get_main ();
697 error = ikev2_initiate_rekey_child_sa (vm, mp->ispi);
699 rv = VNET_API_ERROR_UNSPECIFIED;
701 rv = VNET_API_ERROR_UNIMPLEMENTED;
704 REPLY_MACRO (VL_API_IKEV2_INITIATE_REKEY_CHILD_SA_REPLY);
709 * Add vpe's API message handlers to the table.
710 * vlib has alread mapped shared memory and
711 * added the client registration handlers.
712 * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
714 #define vl_msg_name_crc_list
715 #include <vnet/vnet_all_api_h.h>
716 #undef vl_msg_name_crc_list
719 setup_message_id_table (api_main_t * am)
721 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
722 foreach_vl_msg_name_crc_ipsec;
726 static clib_error_t *
727 ipsec_api_hookup (vlib_main_t * vm)
729 api_main_t *am = &api_main;
732 vl_msg_api_set_handlers(VL_API_##N, #n, \
733 vl_api_##n##_t_handler, \
735 vl_api_##n##_t_endian, \
736 vl_api_##n##_t_print, \
737 sizeof(vl_api_##n##_t), 1);
742 * Set up the (msg_name, crc, message-id) table
744 setup_message_id_table (am);
749 VLIB_API_INIT_FUNCTION (ipsec_api_hookup);
752 * fd.io coding-style-patch-verification: ON
755 * eval: (c-set-style "gnu")