aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/l2tp/CMakeLists.txt38
-rw-r--r--src/plugins/l2tp/FEATURE.yaml (renamed from src/vnet/l2tp/FEATURE.yaml)0
-rw-r--r--src/plugins/l2tp/decap.c (renamed from src/vnet/l2tp/decap.c)2
-rw-r--r--src/plugins/l2tp/encap.c (renamed from src/vnet/l2tp/encap.c)2
-rw-r--r--src/plugins/l2tp/l2tp.api (renamed from src/vnet/l2tp/l2tp.api)0
-rw-r--r--src/plugins/l2tp/l2tp.c (renamed from src/vnet/l2tp/l2tp.c)2
-rw-r--r--src/plugins/l2tp/l2tp.h (renamed from src/vnet/l2tp/l2tp.h)2
-rw-r--r--src/plugins/l2tp/l2tp_api.c (renamed from src/vnet/l2tp/l2tp_api.c)76
-rw-r--r--src/plugins/l2tp/l2tp_test.c315
-rw-r--r--src/plugins/l2tp/packet.h (renamed from src/vnet/l2tp/packet.h)0
-rw-r--r--src/plugins/l2tp/pg.c (renamed from src/vnet/l2tp/pg.c)2
-rw-r--r--src/plugins/l2tp/test/test_l2tp.py (renamed from test/test_l2tp.py)0
-rw-r--r--src/vat/api_format.c324
-rw-r--r--src/vnet/CMakeLists.txt23
-rw-r--r--src/vnet/vnet_all_api_h.h1
-rw-r--r--src/vpp/api/custom_dump.c100
16 files changed, 385 insertions, 502 deletions
diff --git a/src/plugins/l2tp/CMakeLists.txt b/src/plugins/l2tp/CMakeLists.txt
new file mode 100644
index 00000000000..c8261abcd9c
--- /dev/null
+++ b/src/plugins/l2tp/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################################################################
+# Tunnel protocol: l2tpv3
+##############################################################################
+add_vpp_plugin(l2tp
+ SOURCES
+ l2tp.c
+ encap.c
+ decap.c
+ pg.c
+ l2tp_api.c
+
+ MULTIARCH_SOURCES
+ encap.c
+ decap.c
+
+ INSTALL_HEADERS
+ l2tp.h
+ packet.h
+
+ API_FILES
+ l2tp.api
+
+ API_TEST_SOURCES
+ l2tp_test.c
+)
diff --git a/src/vnet/l2tp/FEATURE.yaml b/src/plugins/l2tp/FEATURE.yaml
index 58df9b2215e..58df9b2215e 100644
--- a/src/vnet/l2tp/FEATURE.yaml
+++ b/src/plugins/l2tp/FEATURE.yaml
diff --git a/src/vnet/l2tp/decap.c b/src/plugins/l2tp/decap.c
index 787cc115a7e..8c41bdd2357 100644
--- a/src/vnet/l2tp/decap.c
+++ b/src/plugins/l2tp/decap.c
@@ -20,7 +20,7 @@
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/l2tp/l2tp.h>
+#include <l2tp/l2tp.h>
#include <vnet/l2/l2_input.h>
/* Statistics (not really errors) */
diff --git a/src/vnet/l2tp/encap.c b/src/plugins/l2tp/encap.c
index 8863ddfa20d..fbb5fc6ea46 100644
--- a/src/vnet/l2tp/encap.c
+++ b/src/plugins/l2tp/encap.c
@@ -20,7 +20,7 @@
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/l2tp/l2tp.h>
+#include <l2tp/l2tp.h>
/* Statistics (not really errors) */
#define foreach_l2t_encap_error \
diff --git a/src/vnet/l2tp/l2tp.api b/src/plugins/l2tp/l2tp.api
index 618c4122fd6..618c4122fd6 100644
--- a/src/vnet/l2tp/l2tp.api
+++ b/src/plugins/l2tp/l2tp.api
diff --git a/src/vnet/l2tp/l2tp.c b/src/plugins/l2tp/l2tp.c
index fa112ee7986..242f4323e37 100644
--- a/src/vnet/l2tp/l2tp.c
+++ b/src/plugins/l2tp/l2tp.c
@@ -21,7 +21,7 @@
#include <vnet/ip/ip.h>
#include <vnet/l2/l2_input.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/l2tp/l2tp.h>
+#include <l2tp/l2tp.h>
l2t_main_t l2t_main;
diff --git a/src/vnet/l2tp/l2tp.h b/src/plugins/l2tp/l2tp.h
index 49873380057..949d5d369bd 100644
--- a/src/vnet/l2tp/l2tp.h
+++ b/src/plugins/l2tp/l2tp.h
@@ -20,7 +20,7 @@
#include <vlib/vlib.h>
#include <vnet/ip/ip.h>
-#include <vnet/l2tp/packet.h>
+#include <l2tp/packet.h>
typedef struct
{
diff --git a/src/vnet/l2tp/l2tp_api.c b/src/plugins/l2tp/l2tp_api.c
index 3a31372253f..fb675ddff5e 100644
--- a/src/vnet/l2tp/l2tp_api.c
+++ b/src/plugins/l2tp/l2tp_api.c
@@ -22,34 +22,22 @@
#include <vnet/interface.h>
#include <vnet/api_errno.h>
-#include <vnet/l2tp/l2tp.h>
+#include <l2tp/l2tp.h>
#include <vnet/ip/ip_types_api.h>
-#include <vnet/vnet_msg_enum.h>
+/* define message IDs */
+#include <vnet/format_fns.h>
+#include <l2tp/l2tp.api_enum.h>
+#include <l2tp/l2tp.api_types.h>
-#define vl_typedefs /* define message structures */
-#include <vnet/vnet_all_api_h.h>
-#undef vl_typedefs
-
-#define vl_endianfun /* define message structures */
-#include <vnet/vnet_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
-#define vl_printfun
-#include <vnet/vnet_all_api_h.h>
-#undef vl_printfun
+/**
+ * Base message ID fot the plugin
+ */
+static u32 l2tp_base_msg_id;
+#define REPLY_MSG_ID_BASE l2tp_base_msg_id
#include <vlibapi/api_helper_macros.h>
-#define foreach_vpe_api_msg \
-_(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \
-_(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \
-_(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \
-_(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \
-_(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump)
-
static void
send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am,
vl_api_registration_t * reg,
@@ -67,9 +55,10 @@ send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_SW_IF_L2TPV3_TUNNEL_DETAILS);
- strncpy ((char *) mp->interface_name,
- (char *) if_name, ARRAY_LEN (mp->interface_name) - 1);
+ mp->_vl_msg_id =
+ ntohs (VL_API_SW_IF_L2TPV3_TUNNEL_DETAILS + REPLY_MSG_ID_BASE);
+ strncpy ((char *) mp->interface_name, (char *) if_name,
+ ARRAY_LEN (mp->interface_name) - 1);
mp->sw_if_index = ntohl (si->sw_if_index);
mp->local_session_id = s->local_session_id;
mp->remote_session_id = s->remote_session_id;
@@ -227,43 +216,32 @@ out:
* added the client registration handlers.
* See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
*/
-#define vl_msg_name_crc_list
-#include <vnet/vnet_all_api_h.h>
-#undef vl_msg_name_crc_list
-
-static void
-setup_message_id_table (api_main_t * am)
-{
-#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
- foreach_vl_msg_name_crc_l2tp;
-#undef _
-}
+#include <l2tp/l2tp.api.c>
static clib_error_t *
l2tp_api_hookup (vlib_main_t * vm)
{
- api_main_t *am = vlibapi_get_main ();
-
-#define _(N,n) \
- vl_msg_api_set_handlers(VL_API_##N, #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_vpe_api_msg;
-#undef _
-
/*
* Set up the (msg_name, crc, message-id) table
*/
- setup_message_id_table (am);
+ l2tp_base_msg_id = setup_message_id_table ();
return 0;
}
VLIB_API_INIT_FUNCTION (l2tp_api_hookup);
+#include <vlib/unix/plugin.h>
+#include <vpp/app/version.h>
+
+/* *INDENT-OFF* */
+VLIB_PLUGIN_REGISTER () = {
+ .version = VPP_BUILD_VER,
+ .description = "Layer 2 Tunneling Protocol v3 (L2TP)",
+};
+/* *INDENT-ON* */
+
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/plugins/l2tp/l2tp_test.c b/src/plugins/l2tp/l2tp_test.c
new file mode 100644
index 00000000000..87abf5d0a2a
--- /dev/null
+++ b/src/plugins/l2tp/l2tp_test.c
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2020 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vat/vat.h>
+#include <vlibapi/api.h>
+#include <vlibmemory/api.h>
+#include <vppinfra/error.h>
+
+#include <vnet/ip/ip_format_fns.h>
+#include <vnet/ip/ip.h>
+#include <vnet/ethernet/ethernet_format_fns.h>
+#include <l2tp/l2tp.h>
+
+/* define message IDs */
+#include <l2tp/l2tp.api_enum.h>
+#include <l2tp/l2tp.api_types.h>
+#include <vpp/api/vpe.api_types.h>
+
+typedef struct
+{
+ /* API message ID base */
+ u16 msg_id_base;
+ u32 ping_id;
+ vat_main_t *vat_main;
+} l2tp_test_main_t;
+
+l2tp_test_main_t l2tp_test_main;
+
+#define __plugin_msg_base l2tp_test_main.msg_id_base
+#include <vlibapi/vat_helper_macros.h>
+
+/* Macro to finish up custom dump fns */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define FINISH \
+ vec_add1 (s, 0); \
+ vl_print (handle, (char *)s); \
+ vec_free (s); \
+ return handle;
+
+static void vl_api_l2tpv3_create_tunnel_reply_t_handler
+ (vl_api_l2tpv3_create_tunnel_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->sw_if_index = ntohl (mp->sw_if_index);
+ vam->result_ready = 1;
+ }
+}
+
+static int
+api_l2tpv3_create_tunnel (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ ip6_address_t client_address, our_address;
+ int client_address_set = 0;
+ int our_address_set = 0;
+ u32 local_session_id = 0;
+ u32 remote_session_id = 0;
+ u64 local_cookie = 0;
+ u64 remote_cookie = 0;
+ u8 l2_sublayer_present = 0;
+ vl_api_l2tpv3_create_tunnel_t *mp;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "client_address %U", unformat_ip6_address,
+ &client_address))
+ client_address_set = 1;
+ else if (unformat (i, "our_address %U", unformat_ip6_address,
+ &our_address))
+ our_address_set = 1;
+ else if (unformat (i, "local_session_id %d", &local_session_id))
+ ;
+ else if (unformat (i, "remote_session_id %d", &remote_session_id))
+ ;
+ else if (unformat (i, "local_cookie %lld", &local_cookie))
+ ;
+ else if (unformat (i, "remote_cookie %lld", &remote_cookie))
+ ;
+ else if (unformat (i, "l2-sublayer-present"))
+ l2_sublayer_present = 1;
+ else
+ break;
+ }
+
+ if (client_address_set == 0)
+ {
+ errmsg ("client_address required");
+ return -99;
+ }
+
+ if (our_address_set == 0)
+ {
+ errmsg ("our_address required");
+ return -99;
+ }
+
+ M (L2TPV3_CREATE_TUNNEL, mp);
+
+ clib_memcpy (mp->client_address.un.ip6, client_address.as_u8,
+ sizeof (ip6_address_t));
+
+ clib_memcpy (mp->our_address.un.ip6, our_address.as_u8,
+ sizeof (ip6_address_t));
+
+ mp->local_session_id = ntohl (local_session_id);
+ mp->remote_session_id = ntohl (remote_session_id);
+ mp->local_cookie = clib_host_to_net_u64 (local_cookie);
+ mp->remote_cookie = clib_host_to_net_u64 (remote_cookie);
+ mp->l2_sublayer_present = l2_sublayer_present;
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
+api_l2tpv3_set_tunnel_cookies (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ u32 sw_if_index;
+ u8 sw_if_index_set = 0;
+ u64 new_local_cookie = 0;
+ u64 new_remote_cookie = 0;
+ vl_api_l2tpv3_set_tunnel_cookies_t *mp;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
+ sw_if_index_set = 1;
+ else if (unformat (i, "sw_if_index %d", &sw_if_index))
+ sw_if_index_set = 1;
+ else if (unformat (i, "new_local_cookie %lld", &new_local_cookie))
+ ;
+ else if (unformat (i, "new_remote_cookie %lld", &new_remote_cookie))
+ ;
+ else
+ break;
+ }
+
+ if (sw_if_index_set == 0)
+ {
+ errmsg ("missing interface name or sw_if_index");
+ return -99;
+ }
+
+ M (L2TPV3_SET_TUNNEL_COOKIES, mp);
+
+ mp->sw_if_index = ntohl (sw_if_index);
+ mp->new_local_cookie = clib_host_to_net_u64 (new_local_cookie);
+ mp->new_remote_cookie = clib_host_to_net_u64 (new_remote_cookie);
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
+api_l2tpv3_interface_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_l2tpv3_interface_enable_disable_t *mp;
+ u32 sw_if_index;
+ u8 sw_if_index_set = 0;
+ u8 enable_disable = 1;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
+ sw_if_index_set = 1;
+ else if (unformat (i, "sw_if_index %d", &sw_if_index))
+ sw_if_index_set = 1;
+ else if (unformat (i, "enable"))
+ enable_disable = 1;
+ else if (unformat (i, "disable"))
+ enable_disable = 0;
+ else
+ break;
+ }
+
+ if (sw_if_index_set == 0)
+ {
+ errmsg ("missing interface name or sw_if_index");
+ return -99;
+ }
+
+ M (L2TPV3_INTERFACE_ENABLE_DISABLE, mp);
+
+ mp->sw_if_index = ntohl (sw_if_index);
+ mp->enable_disable = enable_disable;
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
+api_l2tpv3_set_lookup_key (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_l2tpv3_set_lookup_key_t *mp;
+ u8 key = ~0;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "lookup_v6_src"))
+ key = L2T_LOOKUP_SRC_ADDRESS;
+ else if (unformat (i, "lookup_v6_dst"))
+ key = L2T_LOOKUP_DST_ADDRESS;
+ else if (unformat (i, "lookup_session_id"))
+ key = L2T_LOOKUP_SESSION_ID;
+ else
+ break;
+ }
+
+ if (key == (u8) ~ 0)
+ {
+ errmsg ("l2tp session lookup key unset");
+ return -99;
+ }
+
+ M (L2TPV3_SET_LOOKUP_KEY, mp);
+
+ mp->key = key;
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static void vl_api_sw_if_l2tpv3_tunnel_details_t_handler
+ (vl_api_sw_if_l2tpv3_tunnel_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ print (vam->ofp, "* %U (our) %U (client) (sw_if_index %d)",
+ format_ip6_address, mp->our_address,
+ format_ip6_address, mp->client_address,
+ clib_net_to_host_u32 (mp->sw_if_index));
+
+ print (vam->ofp,
+ " local cookies %016llx %016llx remote cookie %016llx",
+ clib_net_to_host_u64 (mp->local_cookie[0]),
+ clib_net_to_host_u64 (mp->local_cookie[1]),
+ clib_net_to_host_u64 (mp->remote_cookie));
+
+ print (vam->ofp, " local session-id %d remote session-id %d",
+ clib_net_to_host_u32 (mp->local_session_id),
+ clib_net_to_host_u32 (mp->remote_session_id));
+
+ print (vam->ofp, " l2 specific sublayer %s\n",
+ mp->l2_sublayer_present ? "preset" : "absent");
+
+}
+
+static int
+api_sw_if_l2tpv3_tunnel_dump (vat_main_t * vam)
+{
+ vl_api_sw_if_l2tpv3_tunnel_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ /* Get list of l2tpv3-tunnel interfaces */
+ M (SW_IF_L2TPV3_TUNNEL_DUMP, mp);
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ if (!l2tp_test_main.ping_id)
+ l2tp_test_main.ping_id =
+ vl_msg_api_get_msg_index ((u8 *) (VL_API_CONTROL_PING_CRC));
+ mp_ping = vl_msg_api_alloc_as_if_client (sizeof (*mp_ping));
+ mp_ping->_vl_msg_id = htons (l2tp_test_main.ping_id);
+ mp_ping->client_index = vam->my_client_index;
+
+ fformat (vam->ofp, "Sending ping id=%d\n", l2tp_test_main.ping_id);
+
+ vam->result_ready = 0;
+ S (mp_ping);
+
+ W (ret);
+ return ret;
+}
+
+#include <l2tp/l2tp.api_test.c>
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/l2tp/packet.h b/src/plugins/l2tp/packet.h
index 66dfea2194c..66dfea2194c 100644
--- a/src/vnet/l2tp/packet.h
+++ b/src/plugins/l2tp/packet.h
diff --git a/src/vnet/l2tp/pg.c b/src/plugins/l2tp/pg.c
index 1e523d3bbb0..f8edb6908aa 100644
--- a/src/vnet/l2tp/pg.c
+++ b/src/plugins/l2tp/pg.c
@@ -17,7 +17,7 @@
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
-#include <vnet/l2tp/l2tp.h>
+#include <l2tp/l2tp.h>
typedef struct
{
diff --git a/test/test_l2tp.py b/src/plugins/l2tp/test/test_l2tp.py
index c57b5912de1..c57b5912de1 100644
--- a/test/test_l2tp.py
+++ b/src/plugins/l2tp/test/test_l2tp.py
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 0d0ec59d1f8..926f65dcd86 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -27,7 +27,6 @@
#include <vnet/ip-neighbor/ip_neighbor.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/l2/l2_input.h>
-#include <vnet/l2tp/l2tp.h>
#include <vnet/vxlan/vxlan.h>
#include <vnet/gre/gre.h>
#include <vnet/vxlan-gpe/vxlan_gpe.h>
@@ -2296,40 +2295,6 @@ static void vl_api_mpls_tunnel_add_del_reply_t_handler_json
vam->result_ready = 1;
}
-static void vl_api_l2tpv3_create_tunnel_reply_t_handler
- (vl_api_l2tpv3_create_tunnel_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
- if (vam->async_mode)
- {
- vam->async_errors += (retval < 0);
- }
- else
- {
- vam->retval = retval;
- vam->sw_if_index = ntohl (mp->sw_if_index);
- vam->result_ready = 1;
- }
-}
-
-static void vl_api_l2tpv3_create_tunnel_reply_t_handler_json
- (vl_api_l2tpv3_create_tunnel_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
static void vl_api_gpe_add_del_fwd_entry_reply_t_handler
(vl_api_gpe_add_del_fwd_entry_reply_t * mp)
{
@@ -5121,9 +5086,6 @@ _(sr_steering_add_del_reply) \
_(classify_add_del_session_reply) \
_(classify_set_interface_ip_table_reply) \
_(classify_set_interface_l2_tables_reply) \
-_(l2tpv3_set_tunnel_cookies_reply) \
-_(l2tpv3_interface_enable_disable_reply) \
-_(l2tpv3_set_lookup_key_reply) \
_(l2_fib_clear_table_reply) \
_(l2_interface_efp_filter_reply) \
_(l2_interface_vlan_tag_rewrite_reply) \
@@ -5320,12 +5282,6 @@ _(CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY, \
classify_set_interface_l2_tables_reply) \
_(GET_NODE_INDEX_REPLY, get_node_index_reply) \
_(ADD_NODE_NEXT_REPLY, add_node_next_reply) \
-_(L2TPV3_CREATE_TUNNEL_REPLY, l2tpv3_create_tunnel_reply) \
-_(L2TPV3_SET_TUNNEL_COOKIES_REPLY, l2tpv3_set_tunnel_cookies_reply) \
-_(L2TPV3_INTERFACE_ENABLE_DISABLE_REPLY, \
- l2tpv3_interface_enable_disable_reply) \
-_(L2TPV3_SET_LOOKUP_KEY_REPLY, l2tpv3_set_lookup_key_reply) \
-_(SW_IF_L2TPV3_TUNNEL_DETAILS, sw_if_l2tpv3_tunnel_details) \
_(VXLAN_ADD_DEL_TUNNEL_REPLY, vxlan_add_del_tunnel_reply) \
_(VXLAN_OFFLOAD_RX_REPLY, vxlan_offload_rx_reply) \
_(VXLAN_TUNNEL_DETAILS, vxlan_tunnel_details) \
@@ -11146,274 +11102,6 @@ api_add_node_next (vat_main_t * vam)
return ret;
}
-static int
-api_l2tpv3_create_tunnel (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- ip6_address_t client_address, our_address;
- int client_address_set = 0;
- int our_address_set = 0;
- u32 local_session_id = 0;
- u32 remote_session_id = 0;
- u64 local_cookie = 0;
- u64 remote_cookie = 0;
- u8 l2_sublayer_present = 0;
- vl_api_l2tpv3_create_tunnel_t *mp;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "client_address %U", unformat_ip6_address,
- &client_address))
- client_address_set = 1;
- else if (unformat (i, "our_address %U", unformat_ip6_address,
- &our_address))
- our_address_set = 1;
- else if (unformat (i, "local_session_id %d", &local_session_id))
- ;
- else if (unformat (i, "remote_session_id %d", &remote_session_id))
- ;
- else if (unformat (i, "local_cookie %lld", &local_cookie))
- ;
- else if (unformat (i, "remote_cookie %lld", &remote_cookie))
- ;
- else if (unformat (i, "l2-sublayer-present"))
- l2_sublayer_present = 1;
- else
- break;
- }
-
- if (client_address_set == 0)
- {
- errmsg ("client_address required");
- return -99;
- }
-
- if (our_address_set == 0)
- {
- errmsg ("our_address required");
- return -99;
- }
-
- M (L2TPV3_CREATE_TUNNEL, mp);
-
- clib_memcpy (mp->client_address.un.ip6, client_address.as_u8,
- sizeof (ip6_address_t));
-
- clib_memcpy (mp->our_address.un.ip6, our_address.as_u8,
- sizeof (ip6_address_t));
-
- mp->local_session_id = ntohl (local_session_id);
- mp->remote_session_id = ntohl (remote_session_id);
- mp->local_cookie = clib_host_to_net_u64 (local_cookie);
- mp->remote_cookie = clib_host_to_net_u64 (remote_cookie);
- mp->l2_sublayer_present = l2_sublayer_present;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_l2tpv3_set_tunnel_cookies (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- u32 sw_if_index;
- u8 sw_if_index_set = 0;
- u64 new_local_cookie = 0;
- u64 new_remote_cookie = 0;
- vl_api_l2tpv3_set_tunnel_cookies_t *mp;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "new_local_cookie %lld", &new_local_cookie))
- ;
- else if (unformat (i, "new_remote_cookie %lld", &new_remote_cookie))
- ;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing interface name or sw_if_index");
- return -99;
- }
-
- M (L2TPV3_SET_TUNNEL_COOKIES, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
- mp->new_local_cookie = clib_host_to_net_u64 (new_local_cookie);
- mp->new_remote_cookie = clib_host_to_net_u64 (new_remote_cookie);
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_l2tpv3_interface_enable_disable (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_l2tpv3_interface_enable_disable_t *mp;
- u32 sw_if_index;
- u8 sw_if_index_set = 0;
- u8 enable_disable = 1;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "enable"))
- enable_disable = 1;
- else if (unformat (i, "disable"))
- enable_disable = 0;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing interface name or sw_if_index");
- return -99;
- }
-
- M (L2TPV3_INTERFACE_ENABLE_DISABLE, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
- mp->enable_disable = enable_disable;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_l2tpv3_set_lookup_key (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_l2tpv3_set_lookup_key_t *mp;
- u8 key = ~0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "lookup_v6_src"))
- key = L2T_LOOKUP_SRC_ADDRESS;
- else if (unformat (i, "lookup_v6_dst"))
- key = L2T_LOOKUP_DST_ADDRESS;
- else if (unformat (i, "lookup_session_id"))
- key = L2T_LOOKUP_SESSION_ID;
- else
- break;
- }
-
- if (key == (u8) ~ 0)
- {
- errmsg ("l2tp session lookup key unset");
- return -99;
- }
-
- M (L2TPV3_SET_LOOKUP_KEY, mp);
-
- mp->key = key;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static void vl_api_sw_if_l2tpv3_tunnel_details_t_handler
- (vl_api_sw_if_l2tpv3_tunnel_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
-
- print (vam->ofp, "* %U (our) %U (client) (sw_if_index %d)",
- format_ip6_address, mp->our_address,
- format_ip6_address, mp->client_address,
- clib_net_to_host_u32 (mp->sw_if_index));
-
- print (vam->ofp,
- " local cookies %016llx %016llx remote cookie %016llx",
- clib_net_to_host_u64 (mp->local_cookie[0]),
- clib_net_to_host_u64 (mp->local_cookie[1]),
- clib_net_to_host_u64 (mp->remote_cookie));
-
- print (vam->ofp, " local session-id %d remote session-id %d",
- clib_net_to_host_u32 (mp->local_session_id),
- clib_net_to_host_u32 (mp->remote_session_id));
-
- print (vam->ofp, " l2 specific sublayer %s\n",
- mp->l2_sublayer_present ? "preset" : "absent");
-
-}
-
-static void vl_api_sw_if_l2tpv3_tunnel_details_t_handler_json
- (vl_api_sw_if_l2tpv3_tunnel_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
- struct in6_addr addr;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
-
- clib_memcpy (&addr, mp->our_address.un.ip6, sizeof (addr));
- vat_json_object_add_ip6 (node, "our_address", addr);
- clib_memcpy (&addr, mp->client_address.un.ip6, sizeof (addr));
- vat_json_object_add_ip6 (node, "client_address", addr);
-
- vat_json_node_t *lc = vat_json_object_add (node, "local_cookie");
- vat_json_init_array (lc);
- vat_json_array_add_uint (lc, clib_net_to_host_u64 (mp->local_cookie[0]));
- vat_json_array_add_uint (lc, clib_net_to_host_u64 (mp->local_cookie[1]));
- vat_json_object_add_uint (node, "remote_cookie",
- clib_net_to_host_u64 (mp->remote_cookie));
-
- printf ("local id: %u", clib_net_to_host_u32 (mp->local_session_id));
- vat_json_object_add_uint (node, "local_session_id",
- clib_net_to_host_u32 (mp->local_session_id));
- vat_json_object_add_uint (node, "remote_session_id",
- clib_net_to_host_u32 (mp->remote_session_id));
- vat_json_object_add_string_copy (node, "l2_sublayer",
- mp->l2_sublayer_present ? (u8 *) "present"
- : (u8 *) "absent");
-}
-
-static int
-api_sw_if_l2tpv3_tunnel_dump (vat_main_t * vam)
-{
- vl_api_sw_if_l2tpv3_tunnel_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
-
- /* Get list of l2tpv3-tunnel interfaces */
- M (SW_IF_L2TPV3_TUNNEL_DUMP, mp);
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- W (ret);
- return ret;
-}
-
-
static void vl_api_sw_interface_tap_v2_details_t_handler
(vl_api_sw_interface_tap_v2_details_t * mp)
{
@@ -20425,18 +20113,6 @@ _(classify_set_interface_l2_tables, \
" [other-table <nn>]") \
_(get_node_index, "node <node-name") \
_(add_node_next, "node <node-name> next <next-node-name>") \
-_(l2tpv3_create_tunnel, \
- "client_address <ip6-addr> our_address <ip6-addr>\n" \
- "[local_session_id <nn>][remote_session_id <nn>][local_cookie <nn>]\n" \
- "[remote_cookie <nn>]\n[l2-sublayer-preset]\n") \
-_(l2tpv3_set_tunnel_cookies, \
- "<intfc> | sw_if_index <nn> [new_local_cookie <nn>]\n" \
- "[new_remote_cookie <nn>]\n") \
-_(l2tpv3_interface_enable_disable, \
- "<intfc> | sw_if_index <nn> enable | disable") \
-_(l2tpv3_set_lookup_key, \
- "lookup_v6_src | lookup_v6_dst | lookup_session_id") \
-_(sw_if_l2tpv3_tunnel_dump, "") \
_(vxlan_offload_rx, \
"hw { <interface name> | hw_if_index <nn>} " \
"rx { <vxlan tunnel name> | sw_if_index <nn> } [del]") \
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 8c315ce5d73..579302c4687 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -762,29 +762,6 @@ list(APPEND VNET_HEADERS
)
##############################################################################
-# Tunnel protocol: l2tpv3
-##############################################################################
-list(APPEND VNET_SOURCES
- l2tp/l2tp.c
- l2tp/encap.c
- l2tp/decap.c
- l2tp/pg.c
- l2tp/l2tp_api.c
-)
-
-list(APPEND VNET_MULTIARCH_SOURCES
- l2tp/encap.c
- l2tp/decap.c
-)
-
-list(APPEND VNET_HEADERS
- l2tp/l2tp.h
- l2tp/packet.h
-)
-
-list(APPEND VNET_API_FILES l2tp/l2tp.api)
-
-##############################################################################
# Tunnel protocol: gre+mpls
##############################################################################
list(APPEND VNET_SOURCES
diff --git a/src/vnet/vnet_all_api_h.h b/src/vnet/vnet_all_api_h.h
index 9daf5e95b4d..86edc88ac49 100644
--- a/src/vnet/vnet_all_api_h.h
+++ b/src/vnet/vnet_all_api_h.h
@@ -40,7 +40,6 @@
#include <vnet/gre/gre.api.h>
#include <vnet/interface.api.h>
#include <vnet/l2/l2.api.h>
-#include <vnet/l2tp/l2tp.api.h>
#include <vnet/span/span.api.h>
#include <vnet/ip/ip.api.h>
#include <vnet/vxlan/vxlan.api.h>
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index 46beb685810..b17e7ded2b2 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -24,7 +24,6 @@
#include <vnet/fib/fib_api.h>
#include <vnet/unix/tuntap.h>
#include <vnet/mpls/mpls.h>
-#include <vnet/l2tp/l2tp.h>
#include <vnet/l2/l2_input.h>
#include <vnet/srv6/sr.h>
#include <vnet/srmpls/sr_mpls.h>
@@ -1429,100 +1428,6 @@ static void *vl_api_add_node_next_t_print
FINISH;
}
-static void *vl_api_l2tpv3_create_tunnel_t_print
- (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
-
- s = format (s, "client_address %U our_address %U ",
- format_ip6_address,
- (ip6_address_t *) (mp->client_address.un.ip6),
- format_ip6_address, (ip6_address_t *) (mp->our_address.un.ip6));
- s = format (s, "local_session_id %d ", (mp->local_session_id));
- s = format (s, "remote_session_id %d ", (mp->remote_session_id));
- s = format (s, "local_cookie %lld ",
- clib_net_to_host_u64 (mp->local_cookie));
- s = format (s, "remote_cookie %lld ",
- clib_net_to_host_u64 (mp->remote_cookie));
- if (mp->l2_sublayer_present)
- s = format (s, "l2-sublayer-present ");
-
- FINISH;
-}
-
-static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
- (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
-
- s = format (s, "sw_if_index %d ", (mp->sw_if_index));
-
- s = format (s, "new_local_cookie %llu ",
- clib_net_to_host_u64 (mp->new_local_cookie));
-
- s = format (s, "new_remote_cookie %llu ",
- clib_net_to_host_u64 (mp->new_remote_cookie));
-
- FINISH;
-}
-
-static void *vl_api_l2tpv3_interface_enable_disable_t_print
- (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
-
- s = format (s, "sw_if_index %d ", (mp->sw_if_index));
-
- if (mp->enable_disable == 0)
- s = format (s, "del ");
-
- FINISH;
-}
-
-static void *vl_api_l2tpv3_set_lookup_key_t_print
- (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
-{
- u8 *s;
- char *str = "unknown";
-
- s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
-
- switch (mp->key)
- {
- case L2T_LOOKUP_SRC_ADDRESS:
- str = "lookup_v6_src";
- break;
- case L2T_LOOKUP_DST_ADDRESS:
- str = "lookup_v6_dst";
- break;
- case L2T_LOOKUP_SESSION_ID:
- str = "lookup_session_id";
- break;
- default:
- break;
- }
-
- s = format (s, "%s ", str);
-
- FINISH;
-}
-
-static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
- (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
-
- FINISH;
-}
-
static void *vl_api_vxlan_add_del_tunnel_t_print
(vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
{
@@ -3552,11 +3457,6 @@ _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \
_(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
_(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
_(ADD_NODE_NEXT, add_node_next) \
-_(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \
-_(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \
-_(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \
-_(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \
-_(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \
_(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \
_(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \
_(VXLAN_OFFLOAD_RX, vxlan_offload_rx) \