-static void vl_api_l2tpv3_create_tunnel_t_handler
- (vl_api_l2tpv3_create_tunnel_t * mp)
-{
- vl_api_l2tpv3_create_tunnel_reply_t *rmp;
- l2t_main_t *lm = &l2t_main;
- u32 sw_if_index = (u32) ~ 0;
- int rv;
-
- if (mp->is_ipv6 != 1)
- {
- rv = VNET_API_ERROR_UNIMPLEMENTED;
- goto out;
- }
-
- u32 encap_fib_index;
-
- if (mp->encap_vrf_id != ~0)
- {
- uword *p;
- ip6_main_t *im = &ip6_main;
- if (!
- (p =
- hash_get (im->fib_index_by_table_id, ntohl (mp->encap_vrf_id))))
- {
- rv = VNET_API_ERROR_NO_SUCH_FIB;
- goto out;
- }
- encap_fib_index = p[0];
- }
- else
- {
- encap_fib_index = ~0;
- }
-
- rv = create_l2tpv3_ipv6_tunnel (lm,
- (ip6_address_t *) mp->client_address,
- (ip6_address_t *) mp->our_address,
- ntohl (mp->local_session_id),
- ntohl (mp->remote_session_id),
- clib_net_to_host_u64 (mp->local_cookie),
- clib_net_to_host_u64 (mp->remote_cookie),
- mp->l2_sublayer_present,
- encap_fib_index, &sw_if_index);
-
-out:
- /* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_L2TPV3_CREATE_TUNNEL_REPLY,
- ({
- rmp->sw_if_index = ntohl (sw_if_index);
- }));
- /* *INDENT-ON* */
-}
-
-static void vl_api_l2tpv3_set_tunnel_cookies_t_handler
- (vl_api_l2tpv3_set_tunnel_cookies_t * mp)
-{
- vl_api_l2tpv3_set_tunnel_cookies_reply_t *rmp;
- l2t_main_t *lm = &l2t_main;
- int rv;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- rv = l2tpv3_set_tunnel_cookies (lm, ntohl (mp->sw_if_index),
- clib_net_to_host_u64 (mp->new_local_cookie),
- clib_net_to_host_u64
- (mp->new_remote_cookie));
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_L2TPV3_SET_TUNNEL_COOKIES_REPLY);
-}
-
-static void vl_api_l2tpv3_interface_enable_disable_t_handler
- (vl_api_l2tpv3_interface_enable_disable_t * mp)
-{
- int rv;
- vnet_main_t *vnm = vnet_get_main ();
- vl_api_l2tpv3_interface_enable_disable_reply_t *rmp;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- rv = l2tpv3_interface_enable_disable
- (vnm, ntohl (mp->sw_if_index), mp->enable_disable);
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_L2TPV3_INTERFACE_ENABLE_DISABLE_REPLY);
-}
-
-static void vl_api_l2tpv3_set_lookup_key_t_handler
- (vl_api_l2tpv3_set_lookup_key_t * mp)
-{
- int rv = 0;
- l2t_main_t *lm = &l2t_main;
- vl_api_l2tpv3_set_lookup_key_reply_t *rmp;
-
- if (mp->key > L2T_LOOKUP_SESSION_ID)
- {
- rv = VNET_API_ERROR_INVALID_VALUE;
- goto out;
- }
-
- lm->lookup_type = mp->key;
-
-out:
- REPLY_MACRO (VL_API_L2TPV3_SET_LOOKUP_KEY_REPLY);
-}
-