- vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main ();
- vl_api_ipsec_sa_set_key_reply_t *rmp;
- int rv;
-#if WITH_LIBSSL > 0
- ipsec_sa_t sa;
- sa.id = ntohl (mp->sa_id);
- sa.crypto_key_len = mp->crypto_key_length;
- clib_memcpy (&sa.crypto_key, mp->crypto_key, sizeof (sa.crypto_key));
- sa.integ_key_len = mp->integrity_key_length;
- clib_memcpy (&sa.integ_key, mp->integrity_key, sizeof (sa.integ_key));
-
- rv = ipsec_set_sa_key (vm, &sa);
-#else
- rv = VNET_API_ERROR_UNIMPLEMENTED;
-#endif
-
- REPLY_MACRO (VL_API_IPSEC_SA_SET_KEY_REPLY);
-}
-
-static void
-vl_api_ipsec_tunnel_if_add_del_t_handler (vl_api_ipsec_tunnel_if_add_del_t *
- mp)
-{
- vl_api_ipsec_tunnel_if_add_del_reply_t *rmp;
- ipsec_main_t *im = &ipsec_main;
- vnet_main_t *vnm = im->vnet_main;
- u32 sw_if_index = ~0;
- int rv;
-
-#if WITH_LIBSSL > 0
- ipsec_add_del_tunnel_args_t tun;
-
- memset (&tun, 0, sizeof (ipsec_add_del_tunnel_args_t));
-
- tun.is_add = mp->is_add;
- tun.esn = mp->esn;
- tun.anti_replay = mp->anti_replay;
- tun.local_spi = ntohl (mp->local_spi);
- tun.remote_spi = ntohl (mp->remote_spi);
- tun.crypto_alg = mp->crypto_alg;
- tun.local_crypto_key_len = mp->local_crypto_key_len;
- tun.remote_crypto_key_len = mp->remote_crypto_key_len;
- tun.integ_alg = mp->integ_alg;
- tun.local_integ_key_len = mp->local_integ_key_len;
- tun.remote_integ_key_len = mp->remote_integ_key_len;
- memcpy (&tun.local_ip, mp->local_ip, 4);
- memcpy (&tun.remote_ip, mp->remote_ip, 4);
- memcpy (&tun.local_crypto_key, &mp->local_crypto_key,
- mp->local_crypto_key_len);
- memcpy (&tun.remote_crypto_key, &mp->remote_crypto_key,
- mp->remote_crypto_key_len);
- memcpy (&tun.local_integ_key, &mp->local_integ_key,
- mp->local_integ_key_len);
- memcpy (&tun.remote_integ_key, &mp->remote_integ_key,
- mp->remote_integ_key_len);
- tun.renumber = mp->renumber;
- tun.show_instance = ntohl (mp->show_instance);
-
- rv = ipsec_add_del_tunnel_if_internal (vnm, &tun, &sw_if_index);
-
-#else
- rv = VNET_API_ERROR_UNIMPLEMENTED;
-#endif
-
- REPLY_MACRO2 (VL_API_IPSEC_TUNNEL_IF_ADD_DEL_REPLY, (
- {
- rmp->sw_if_index =
- htonl (sw_if_index);
- }));
-}
-
-static void
-send_ipsec_sa_details (ipsec_sa_t * sa, vl_api_registration_t * reg,
- u32 context, u32 sw_if_index)
-{
- vl_api_ipsec_sa_details_t *mp;