portranges
poweroff
ppc
+ppp
pppoe
pps
pre
#include <vppinfra/hash.h>
#include <vppinfra/pcap.h>
#include <vnet/srp/srp.h>
-#include <vnet/ppp/ppp.h>
+#include <plugins/ppp/ppp.h>
#include <vnet/hdlc/hdlc.h>
#include <vnet/srp/packet.h>
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
#include <osi/osi.h>
-#include <vnet/ppp/ppp.h>
+#include <plugins/ppp/ppp.h>
#include <vnet/hdlc/hdlc.h>
#include <vnet/llc/llc.h>
+#include <vnet/plugin/plugin.h>
#define foreach_osi_input_next \
_ (PUNT, "error-punt") \
pn->unformat_edit = unformat_pg_osi_header;
}
+typedef void (*ppp_register_input_protocol_fn) (vlib_main_t *vm,
+ ppp_protocol_t protocol,
+ u32 node_index);
+
static clib_error_t *
osi_input_init (vlib_main_t * vm)
{
clib_error_t *error = 0;
osi_main_t *lm = &osi_main;
+ ppp_register_input_protocol_fn ppp_register_input_protocol_fn_ptr;
+
+ ppp_register_input_protocol_fn_ptr =
+ vlib_get_plugin_symbol ("ppp_plugin.so", "ppp_register_input_protocol");
+ if (ppp_register_input_protocol_fn_ptr == 0)
+ {
+ error = clib_error_return (0, "ppp_plugin.so is not loaded");
+ return error;
+ }
if ((error = vlib_call_init_function (vm, osi_init)))
return error;
lm->input_next_by_protocol[i] = OSI_INPUT_NEXT_DROP;
}
- ppp_register_input_protocol (vm, PPP_PROTOCOL_osi, osi_input_node.index);
+ ppp_register_input_protocol_fn_ptr (vm, PPP_PROTOCOL_osi,
+ osi_input_node.index);
hdlc_register_input_protocol (vm, HDLC_PROTOCOL_osi, osi_input_node.index);
llc_register_input_protocol (vm, LLC_PROTOCOL_osi_layer1,
osi_input_node.index);
--- /dev/null
+# Copyright (c) 2024 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.
+
+add_vpp_plugin(ppp
+ SOURCES
+ node.c
+ pg.c
+ ppp.c
+ plugin.c
+
+ INSTALL_HEADERS
+ ppp.h
+ error.def
+ packet.h
+)
\ No newline at end of file
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
-#include <vnet/ppp/ppp.h>
+#include <plugins/ppp/ppp.h>
#include <vppinfra/sparse_vec.h>
#define foreach_ppp_input_next \
static clib_error_t *
ppp_input_init (vlib_main_t * vm)
{
-
{
clib_error_t *error = vlib_call_init_function (vm, ppp_init);
if (error)
VLIB_INIT_FUNCTION (ppp_input_init);
VLIB_WORKER_INIT_FUNCTION (ppp_input_runtime_init);
-void
-ppp_register_input_protocol (vlib_main_t * vm,
- ppp_protocol_t protocol, u32 node_index)
+__clib_export void
+ppp_register_input_protocol (vlib_main_t *vm, ppp_protocol_t protocol,
+ u32 node_index)
{
ppp_main_t *em = &ppp_main;
ppp_protocol_info_t *pi;
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
-#include <vnet/ppp/ppp.h>
+#include <plugins/ppp/ppp.h>
typedef struct
{
--- /dev/null
+/*
+ * plugin.c: ppp
+ *
+ * Copyright (c) 2024 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 <vlib/vlib.h>
+#include <vnet/plugin/plugin.h>
+#include <vpp/app/version.h>
+
+// register a plugin
+VLIB_PLUGIN_REGISTER () = {
+ .version = VPP_BUILD_VER,
+ .description = "Point-to-Point Protocol (PPP) plugin",
+};
/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
+ * Copyright (c) 2024 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:
*/
#include <vnet/vnet.h>
-#include <vnet/ppp/ppp.h>
+#include <plugins/ppp/ppp.h>
/* Global main structure. */
ppp_main_t ppp_main;
ppp_init (vlib_main_t * vm)
{
ppp_main_t *pm = &ppp_main;
+ clib_error_t *error;
+ vlib_node_t *ip4_input_node, *ip6_input_node;
clib_memset (pm, 0, sizeof (pm[0]));
pm->vlib_main = vm;
+ if ((error = vlib_call_init_function (vm, ip_main_init)))
+ return error;
+
+ if ((error = vlib_call_init_function (vm, ip4_init)))
+ return error;
+
+ if ((error = vlib_call_init_function (vm, ip6_init)))
+ return error;
+
pm->protocol_info_by_name = hash_create_string (0, sizeof (uword));
pm->protocol_info_by_protocol = hash_create (0, sizeof (uword));
foreach_ppp_protocol;
#undef _
+ ip4_input_node = vlib_get_node_by_name (vm, (u8 *) "ip4-input");
+ ASSERT (ip4_input_node);
+ ip6_input_node = vlib_get_node_by_name (vm, (u8 *) "ip6-input");
+ ASSERT (ip6_input_node);
+
+ ppp_register_input_protocol (vm, PPP_PROTOCOL_ip4, ip4_input_node->index);
+ ppp_register_input_protocol (vm, PPP_PROTOCOL_ip6, ip6_input_node->index);
+
return vlib_call_init_function (vm, ppp_input_init);
}
/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
+ * Copyright (c) 2024 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:
#define included_ppp_h
#include <vnet/vnet.h>
-#include <vnet/ppp/packet.h>
+#include <ppp/packet.h>
extern vnet_hw_interface_class_t ppp_hw_interface_class;
typedef enum
{
#define ppp_error(n,s) PPP_ERROR_##n,
-#include <vnet/ppp/error.def>
+#include <ppp/error.def>
#undef ppp_error
PPP_N_ERROR,
} ppp_error_t;
unformat_function_t unformat_ppp_header;
unformat_function_t unformat_pg_ppp_header;
-void
-ppp_register_input_protocol (vlib_main_t * vm,
- ppp_protocol_t protocol, u32 node_index);
+__clib_export void ppp_register_input_protocol (vlib_main_t *vm,
+ ppp_protocol_t protocol,
+ u32 node_index);
#endif /* included_ppp_h */
#include <vnet/dpo/interface_tx_dpo.h>
#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
-#include <vnet/ppp/packet.h>
+#include <ppp/packet.h>
#include <pppoe/pppoe.h>
#include <vnet/adj/adj_midchain.h>
#include <vnet/adj/adj_mcast.h>
*/
#include <vlib/vlib.h>
-#include <vnet/ppp/packet.h>
+#include <ppp/packet.h>
#include <pppoe/pppoe.h>
#define foreach_pppoe_cp_next \
*/
#include <vlib/vlib.h>
-#include <vnet/ppp/packet.h>
+#include <ppp/packet.h>
#include <pppoe/pppoe.h>
typedef struct {
srp/srp.h
)
-##############################################################################
-# Layer 2 protocol: PPP
-##############################################################################
-list(APPEND VNET_SOURCES
- ppp/node.c
- ppp/pg.c
- ppp/ppp.c
-)
-
-list(APPEND VNET_HEADERS
- ppp/error.def
- ppp/ppp.h
- ppp/packet.h
-)
-
##############################################################################
# Layer 2 protocol: HDLC
##############################################################################
#include <vnet/ip/ip_frag.h>
#include <vnet/ethernet/ethernet.h> /* for ethernet_header_t */
#include <vnet/ethernet/arp_packet.h> /* for ethernet_arp_header_t */
-#include <vnet/ppp/ppp.h>
#include <vnet/srp/srp.h> /* for srp_hw_interface_class */
#include <vnet/api_errno.h> /* for API error numbers */
#include <vnet/fib/fib_table.h> /* for FIB table and entry creation */
#include <vnet/ip/ip4_input.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/pg/pg.h>
-#include <vnet/ppp/ppp.h>
#include <vnet/hdlc/hdlc.h>
#include <vnet/util/throttle.h>
clib_error_t *error;
ethernet_register_input_type (vm, ETHERNET_TYPE_IP4, ip4_input_node.index);
- ppp_register_input_protocol (vm, PPP_PROTOCOL_ip4, ip4_input_node.index);
hdlc_register_input_protocol (vm, HDLC_PROTOCOL_ip4, ip4_input_node.index);
{
#include <vnet/ip/ip6_input.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/ppp/ppp.h>
#include <vnet/hdlc/hdlc.h>
#include <vnet/pg/pg.h>
ip6_init (vlib_main_t * vm)
{
ethernet_register_input_type (vm, ETHERNET_TYPE_IP6, ip6_input_node.index);
- ppp_register_input_protocol (vm, PPP_PROTOCOL_ip6, ip6_input_node.index);
hdlc_register_input_protocol (vm, HDLC_PROTOCOL_ip6, ip6_input_node.index);
{