FD.io VPP  v18.07-rc0-415-g6c78436
Vector Packet Processing
ipsec_gre.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco 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  * @file
17  * @brief L2-GRE over IPSec packet processing.
18 */
19 
20 #ifndef included_ipsec_gre_h
21 #define included_ipsec_gre_h
22 
23 #include <vnet/vnet.h>
24 #include <vnet/gre/packet.h>
25 #include <vnet/gre/gre.h>
26 #include <vnet/ip/ip.h>
27 #include <vnet/ip/ip4.h>
28 #include <vnet/ip/ip4_packet.h>
29 #include <vnet/pg/pg.h>
30 #include <vnet/ip/format.h>
31 
33 
34 /**
35  * @brief IPSec-GRE errors.
36  *
37 */
38 typedef enum
39 {
40 #define ipsec_gre_error(n,s) IPSEC_GRE_ERROR_##n,
41 #include <vnet/ipsec-gre/error.def>
42 #undef ipsec_gre_error
45 
46 /**
47  * @brief IPSec-GRE tunnel parameters.
48  *
49 */
50 typedef struct
51 {
52  /* Required for pool_get_aligned */
53  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
54  ip4_address_t tunnel_src; /**< tunnel IPv4 src address */
55  ip4_address_t tunnel_dst; /**< tunnel IPv4 dst address */
56  u32 local_sa; /**< local IPSec SA index */
57  u32 remote_sa; /**< remote IPSec SA index */
58  u32 local_sa_id; /**< local IPSec SA id */
59  u32 remote_sa_id; /**< remote IPSec SA id */
60  u32 hw_if_index;; /**< hardware interface index */
61  u32 sw_if_index;; /**< software interface index */
63 
64 /**
65  * @brief IPSec-GRE state.
66  *
67 */
68 typedef struct
69 {
70  ipsec_gre_tunnel_t *tunnels; /**< pool of tunnel instances */
71 
72  uword *tunnel_by_key; /**< hash mapping src/dst addr pair to tunnel */
73 
74  u32 *free_ipsec_gre_tunnel_hw_if_indices; /**< free vlib hw_if_indices */
75 
76  u32 *tunnel_index_by_sw_if_index; /**< mapping from sw_if_index to tunnel
77  index */
78 
79  vlib_main_t *vlib_main; /**< convenience */
80  vnet_main_t *vnet_main; /**< convenience */
82 
84 
87 
88 /* manually added to the interface output node in ipsec_gre.c */
89 #define IPSEC_GRE_OUTPUT_NEXT_ESP_ENCRYPT 1
90 
91 /**
92  * @brief IPSec-GRE tunnel add/del arguments.
93  *
94 */
95 typedef struct
96 {
97  u8 is_add; /**< 1 - add, 0 - delete */
98 
99  ip4_address_t src; /**< tunnel IPv4 src address */
100  ip4_address_t dst; /**< tunnel IPv4 dst address */
101  u32 lsa; /**< local IPSec SA id */
102  u32 rsa; /**< remote IPSec SA id */
104 
106  (vnet_ipsec_gre_add_del_tunnel_args_t * a, u32 * sw_if_indexp);
107 
108 #endif /* included_ipsec_gre_h */
109 
110 /*
111 * fd.io coding-style-patch-verification: ON
112 *
113 * Local Variables:
114 * eval: (c-set-style "gnu")
115 * End:
116 */
ip4_address_t tunnel_dst
tunnel IPv4 dst address
Definition: ipsec_gre.h:55
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition: cache.h:63
a
Definition: bitmap.h:537
u32 remote_sa
remote IPSec SA index
Definition: ipsec_gre.h:57
ipsec_gre_error_t
IPSec-GRE errors.
Definition: ipsec_gre.h:38
struct _vnet_device_class vnet_device_class_t
unsigned char u8
Definition: types.h:56
ipsec_gre_tunnel_t * tunnels
pool of tunnel instances
Definition: ipsec_gre.h:70
vnet_hw_interface_class_t ipsec_gre_hw_interface_class
unsigned int u32
Definition: types.h:88
u32 sw_if_index
hardware interface index
Definition: ipsec_gre.h:60
u32 remote_sa_id
remote IPSec SA id
Definition: ipsec_gre.h:59
IPSec-GRE tunnel add/del arguments.
Definition: ipsec_gre.h:95
uword * tunnel_by_key
hash mapping src/dst addr pair to tunnel
Definition: ipsec_gre.h:72
ipsec_gre_main_t ipsec_gre_main
Definition: ipsec_gre.c:25
u32 local_sa
local IPSec SA index
Definition: ipsec_gre.h:56
vlib_node_registration_t ipsec_gre_input_node
(constructor) VLIB_REGISTER_NODE (ipsec_gre_input_node)
Definition: node.c:400
u8 is_add
1 - add, 0 - delete
Definition: ipsec_gre.h:97
u32 * tunnel_index_by_sw_if_index
mapping from sw_if_index to tunnel index
Definition: ipsec_gre.h:76
L2-GRE over IPSec errors.
IPSec-GRE state.
Definition: ipsec_gre.h:68
u32 rsa
remote IPSec SA id
Definition: ipsec_gre.h:102
ip4_address_t src
tunnel IPv4 src address
Definition: ipsec_gre.h:99
vnet_device_class_t ipsec_gre_device_class
IPSec-GRE tunnel parameters.
Definition: ipsec_gre.h:50
vnet_main_t * vnet_main
convenience
Definition: ipsec_gre.h:80
struct _vlib_node_registration vlib_node_registration_t
u32 local_sa_id
local IPSec SA id
Definition: ipsec_gre.h:58
ip4_address_t dst
tunnel IPv4 dst address
Definition: ipsec_gre.h:100
struct _vnet_hw_interface_class vnet_hw_interface_class_t
u64 uword
Definition: types.h:112
int vnet_ipsec_gre_add_del_tunnel(vnet_ipsec_gre_add_del_tunnel_args_t *a, u32 *sw_if_indexp)
Add or delete ipsec-gre tunnel interface.
Definition: interface.c:93
u32 * free_ipsec_gre_tunnel_hw_if_indices
free vlib hw_if_indices
Definition: ipsec_gre.h:74
vlib_main_t * vlib_main
convenience
Definition: ipsec_gre.h:79
ip4_address_t tunnel_src
tunnel IPv4 src address
Definition: ipsec_gre.h:54