FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
wireguard.c
Go to the documentation of this file.
1
/*
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:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
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.
14
*/
15
16
#include <
vnet/vnet.h
>
17
#include <
vnet/plugin/plugin.h
>
18
#include <
vnet/ipip/ipip.h
>
19
#include <vpp/app/version.h>
20
21
#include <
wireguard/wireguard_send.h
>
22
#include <
wireguard/wireguard_key.h
>
23
#include <
wireguard/wireguard_if.h
>
24
#include <
wireguard/wireguard.h
>
25
26
wg_main_t
wg_main
;
27
28
static
clib_error_t
*
29
wg_init
(
vlib_main_t
*
vm
)
30
{
31
wg_main_t
*wmp = &
wg_main
;
32
33
wmp->
vlib_main
=
vm
;
34
35
wmp->
in_fq_index
=
vlib_frame_queue_main_init
(
wg_input_node
.index, 0);
36
wmp->
out_fq_index
=
37
vlib_frame_queue_main_init
(
wg_output_tun_node
.index, 0);
38
39
vlib_thread_main_t
*tm =
vlib_get_thread_main
();
40
41
vec_validate_aligned
(wmp->
per_thread_data
, tm->
n_vlib_mains
,
42
CLIB_CACHE_LINE_BYTES
);
43
44
wg_timer_wheel_init
();
45
46
return
(NULL);
47
}
48
49
VLIB_INIT_FUNCTION
(
wg_init
);
50
51
/* *INDENT-OFF* */
52
53
VNET_FEATURE_INIT
(wg_output_tun,
static
) =
54
{
55
.arc_name =
"ip4-output"
,
56
.node_name =
"wg-output-tun"
,
57
.runs_after =
VNET_FEATURES
(
"gso-ip4"
),
58
};
59
60
VLIB_PLUGIN_REGISTER
() =
61
{
62
.version = VPP_BUILD_VER,
63
.description =
"Wireguard Protocol"
,
64
};
65
/* *INDENT-ON* */
66
67
/*
68
* fd.io coding-style-patch-verification: ON
69
*
70
* Local Variables:
71
* eval: (c-set-style "gnu")
72
* End:
73
*/
wireguard_key.h
wg_output_tun_node
vlib_node_registration_t wg_output_tun_node
(constructor) VLIB_REGISTER_NODE (wg_output_tun_node)
Definition:
wireguard_output_tun.c:218
VLIB_PLUGIN_REGISTER
VLIB_PLUGIN_REGISTER()
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition:
nat44_ei.c:3047
wg_init
static clib_error_t * wg_init(vlib_main_t *vm)
Definition:
wireguard.c:29
vlib_frame_queue_main_init
u32 vlib_frame_queue_main_init(u32 node_index, u32 frame_queue_nelts)
Definition:
threads.c:1561
vlib_thread_main_t::n_vlib_mains
u32 n_vlib_mains
Definition:
threads.h:262
VNET_FEATURE_INIT
VNET_FEATURE_INIT(wg_output_tun, static)
wg_main_t::in_fq_index
u32 in_fq_index
Definition:
wireguard.h:40
wg_main_t::per_thread_data
wg_per_thread_data_t * per_thread_data
Definition:
wireguard.h:43
vec_validate_aligned
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
Definition:
vec.h:534
wg_input_node
vlib_node_registration_t wg_input_node
(constructor) VLIB_REGISTER_NODE (wg_input_node)
Definition:
wireguard_input.c:452
wg_main
wg_main_t wg_main
Definition:
wireguard.c:26
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition:
cache.h:58
wireguard_send.h
plugin.h
wg_main_t::vlib_main
vlib_main_t * vlib_main
Definition:
wireguard.h:34
wg_main_t
Definition:
wireguard.h:31
wg_main_t::out_fq_index
u32 out_fq_index
Definition:
wireguard.h:41
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition:
init.h:172
vlib_thread_main_t
Definition:
threads.h:243
wg_timer_wheel_init
void wg_timer_wheel_init()
Definition:
wireguard_timer.c:335
vlib_main_t
Definition:
main.h:102
VNET_FEATURES
#define VNET_FEATURES(...)
Definition:
feature.h:470
clib_error_t
Definition:
clib_error.h:21
wireguard.h
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition:
init.h:51
ipip.h
wireguard_if.h
vnet.h
vlib_get_thread_main
static vlib_thread_main_t * vlib_get_thread_main()
Definition:
global_funcs.h:56
src
plugins
wireguard
wireguard.c
Generated on Sat Jan 8 2022 10:35:56 for FD.io VPP by
1.8.17