2 * Copyright (c) 2020 Doc.ai and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vnet/vnet.h>
17 #include <vnet/plugin/plugin.h>
18 #include <vnet/ipip/ipip.h>
19 #include <vpp/app/version.h>
21 #include <wireguard/wireguard_send.h>
22 #include <wireguard/wireguard_key.h>
23 #include <wireguard/wireguard_if.h>
24 #include <wireguard/wireguard.h>
29 wg_init (vlib_main_t * vm)
31 wg_main_t *wmp = &wg_main;
35 wmp->in_fq_index = vlib_frame_queue_main_init (wg_input_node.index, 0);
37 vlib_frame_queue_main_init (wg_output_tun_node.index, 0);
39 vlib_thread_main_t *tm = vlib_get_thread_main ();
41 vec_validate_aligned (wmp->per_thread_data, tm->n_vlib_mains,
42 CLIB_CACHE_LINE_BYTES);
44 wg_timer_wheel_init ();
49 VLIB_INIT_FUNCTION (wg_init);
53 VNET_FEATURE_INIT (wg_output_tun, static) =
55 .arc_name = "ip4-output",
56 .node_name = "wg-output-tun",
57 .runs_after = VNET_FEATURES ("gso-ip4"),
60 VLIB_PLUGIN_REGISTER () =
62 .version = VPP_BUILD_VER,
63 .description = "Wireguard Protocol",
68 * fd.io coding-style-patch-verification: ON
71 * eval: (c-set-style "gnu")